Xplatform changes

This commit is contained in:
fvanroie 2021-02-16 17:24:00 +01:00
parent 52eef3f657
commit 2148ee7777
3 changed files with 110 additions and 50 deletions

View File

@ -18,7 +18,7 @@ void configStart(void);
void configStop(void);
/* ===== Special Event Processors ===== */
void configWriteConfig(void);
void configWrite(void);
void configOutput(const JsonObject & settings, uint8_t tag = TAG_CONF);
bool configClearEeprom(void);
@ -71,7 +71,6 @@ const char FP_HASP[] PROGMEM = "hasp";
const char FP_GUI[] PROGMEM = "gui";
const char FP_DEBUG[] PROGMEM = "debug";
#endif
#endif // HASP_USE_CONFIG

View File

@ -5,12 +5,14 @@
#define HASP_DEBUG_H
#include "ArduinoJson.h"
#include "ArduinoLog.h"
#include "hasp_macro.h"
#include "lvgl.h"
#include "lang/lang.h"
#ifndef WINDOWS
#include "ArduinoLog.h"
/* ===== Default Event Processors ===== */
void debugPreSetup(JsonObject settings);
void debugSetup();
@ -26,6 +28,59 @@ void debugPrintHaspHeader(Print * output);
void debugStartSyslog(void);
void debugStopSyslog(void);
// void syslogSend(uint8_t log, const char * debugText);
#else
#include <iostream>
#define LOG_FATAL(x, ...) printf(__VA_ARGS__); std::cout << std::endl; fflush(stdout)
#define LOG_ERROR(x, ...) printf(__VA_ARGS__); std::cout << std::endl; fflush(stdout)
#define LOG_WARNING(x, ...) printf(__VA_ARGS__); std::cout << std::endl; fflush(stdout)
#define LOG_NOTICE(x, ...) printf(__VA_ARGS__); std::cout << std::endl; fflush(stdout)
#define LOG_TRACE(x, ...) printf(__VA_ARGS__); std::cout << std::endl; fflush(stdout)
#define LOG_VERBOSE(x, ...) printf(__VA_ARGS__); std::cout << std::endl; fflush(stdout)
#define LOG_DEBUG(x, ...) printf(__VA_ARGS__); std::cout << std::endl; fflush(stdout)
#define LOG_INFO(x, ...) printf(__VA_ARGS__); std::cout << std::endl; fflush(stdout)
/* json keys used in the configfile */
// const char FP_CONFIG_STARTPAGE[] PROGMEM = "startpage";
// const char FP_CONFIG_STARTDIM[] PROGMEM = "startdim";
// const char FP_CONFIG_THEME[] PROGMEM = "theme";
// const char FP_CONFIG_HUE[] PROGMEM = "hue";
// const char FP_CONFIG_ZIFONT[] PROGMEM = "font";
// const char FP_CONFIG_PAGES[] PROGMEM = "pages";
// const char FP_CONFIG_ENABLE[] PROGMEM = "enable";
// const char FP_CONFIG_HOST[] PROGMEM = "host";
// const char FP_CONFIG_PORT[] PROGMEM = "port";
// const char FP_CONFIG_NAME[] PROGMEM = "name";
// const char FP_CONFIG_USER[] PROGMEM = "user";
// const char FP_CONFIG_PASS[] PROGMEM = "pass";
// const char FP_CONFIG_SSID[] PROGMEM = "ssid";
// const char FP_CONFIG_GROUP[] PROGMEM = "group";
// const char FP_CONFIG_BAUD[] PROGMEM = "baud";
// const char FP_CONFIG_LOG[] PROGMEM = "log";
// const char FP_CONFIG_PROTOCOL[] PROGMEM = "proto";
// const char FP_GUI_ROTATION[] PROGMEM = "rotate";
// const char FP_GUI_INVERT[] PROGMEM = "invert";
// const char FP_GUI_TICKPERIOD[] PROGMEM = "tick";
// const char FP_GUI_IDLEPERIOD1[] PROGMEM = "idle1";
// const char FP_GUI_IDLEPERIOD2[] PROGMEM = "idle2";
// const char FP_GUI_CALIBRATION[] PROGMEM = "calibration";
// const char FP_GUI_BACKLIGHTPIN[] PROGMEM = "bckl";
// const char FP_GUI_POINTER[] PROGMEM = "cursor";
// const char FP_DEBUG_TELEPERIOD[] PROGMEM = "tele";
// const char FP_GPIO_CONFIG[] PROGMEM = "config";
// const char FP_HASP_CONFIG_FILE[] PROGMEM = "/config.json";
// const char FP_WIFI[] PROGMEM = "wifi";
// const char FP_MQTT[] PROGMEM = "mqtt";
// const char FP_HTTP[] PROGMEM = "http";
// const char FP_GPIO[] PROGMEM = "gpio";
// const char FP_MDNS[] PROGMEM = "mdns";
// const char FP_HASP[] PROGMEM = "hasp";
// const char FP_GUI[] PROGMEM = "gui";
// const char FP_DEBUG[] PROGMEM = "debug";
#endif
/* ===== Read/Write Configuration ===== */
#if HASP_USE_CONFIG > 0
@ -37,7 +92,8 @@ bool debugSetConfig(const JsonObject & settings);
// void debugPrintSuffix(int level, Print * _logOutput);
// void debugSendOuput(const char * buffer);
enum {
enum
{
TAG_MAIN = 0,
TAG_HASP = 1,
TAG_ATTR = 2,

View File

@ -1,11 +1,14 @@
/* MIT License - Copyright (c) 2020 Francis Van Roie
For full license information read the LICENSE file in the project folder */
#include "hasp_conf.h" // include first
#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0
#include <Arduino.h>
#include "ArduinoJson.h"
#include "ArduinoLog.h"
#include "hasp_conf.h"
#include "hasp_debug.h"
#include "hasp_filesystem.h"
@ -15,7 +18,7 @@ void filesystemInfo()
FSInfo fs_info;
SPIFFS.info(fs_info);
Serial.println("File sistem info.");
Serial.println("File system info.");
Serial.print("Total space: ");
Serial.print(fs_info.totalBytes);
@ -119,3 +122,5 @@ bool filesystemSetup(void)
return false;
}
#endif