Rename settings module

This commit is contained in:
Stephan Mühl
2023-03-22 13:33:45 +01:00
parent d5964bc120
commit ef89b3ed5f
10 changed files with 147 additions and 152 deletions

View File

@@ -3,7 +3,7 @@
#include "MatrixDisplayUi.h"
#include <TJpg_Decoder.h>
#include "icons.h"
#include "Settings.h"
#include "Globals.h"
#include <ArduinoJson.h>
#include "PeripheryManager.h"
#include "MQTTManager.h"

View File

@@ -6,7 +6,7 @@
#include "icons.h"
#include <FastLED_NeoMatrix.h>
#include "MatrixDisplayUi.h"
#include "Settings.h"
#include "Globals.h"
#include "Functions.h"
#include "MenuManager.h"
#include "PeripheryManager.h"

View File

@@ -3,7 +3,7 @@
#include <map>
#include <FastLED_NeoMatrix.h>
#include <Settings.h>
#include <Globals.h>
std::map<char, uint16_t> CharMap = {
{32, 3}, {33, 2}, {34, 4}, {35, 4}, {36, 4}, {37, 4}, {38, 4}, {39, 2}, {40, 3}, {41, 3}, {42, 4}, {43, 4}, {44, 3}, {45, 4}, {46, 2}, {47, 4}, {48, 4}, {49, 4}, {50, 4}, {51, 4}, {52, 4}, {53, 4}, {54, 4}, {55, 4}, {56, 4}, {57, 4}, {58, 2}, {59, 3}, {60, 4}, {61, 4}, {62, 4}, {63, 4}, {64, 4}, {65, 4}, {66, 4}, {67, 4}, {68, 4}, {69, 4}, {70, 4}, {71, 4}, {72, 4}, {73, 2}, {74, 4}, {75, 4}, {76, 4}, {77, 6}, {78, 5}, {79, 4}, {80, 4}, {81, 5}, {82, 4}, {83, 4}, {84, 4}, {85, 4}, {86, 4}, {87, 6}, {88, 4}, {89, 4}, {90, 4}, {91, 4}, {92, 4}, {93, 4}, {94, 4}, {95, 4}, {96, 3}, {97, 4}, {98, 4}, {99, 4}, {100, 4}, {101, 4}, {102, 4}, {103, 4}, {104, 4}, {105, 2}, {106, 4}, {107, 4}, {108, 4}, {109, 4}, {110, 4}, {111, 4}, {112, 4}, {113, 4}, {114, 4}, {115, 4}, {116, 4}, {117, 4}, {118, 4}, {119, 4}, {120, 4}, {121, 4}, {122, 4}, {123, 4}, {124, 2}, {125, 4}, {126, 4}, {161, 2}, {162, 4}, {163, 4}, {164, 4}, {165, 4}, {166, 2}, {167, 4}, {168, 4}, {169, 4}, {170, 4}, {171, 3}, {172, 4}, {173, 3}, {174, 4}, {175, 4}, {176, 4}, {177, 4}, {178, 4}, {179, 4}, {180, 3}, {181, 4}, {182, 4}, {183, 4}, {184, 4}, {185, 2}, {186, 4}, {187, 3}, {188, 4}, {189, 4}, {190, 4}, {191, 4}, {192, 4}, {193, 4}, {194, 4}, {195, 4}, {196, 4}, {197, 4}, {198, 4}, {199, 4}, {200, 4}, {201, 4}, {202, 4}, {203, 4}, {204, 4}, {205, 4}, {206, 4}, {207, 4}, {208, 4}, {209, 4}, {210, 4}, {211, 4}, {212, 4}, {213, 4}, {214, 4}, {215, 4}, {216, 4}, {217, 4}, {218, 4}, {219, 4}, {220, 4}, {221, 4}, {222, 4}, {223, 4}, {224, 4}, {225, 4}, {226, 4}, {227, 4}, {228, 4}, {229, 4}, {230, 4}, {231, 4}, {232, 4}, {233, 4}, {234, 4}, {235, 4}, {236, 3}, {237, 3}, {238, 4}, {239, 4}, {240, 4}, {241, 4}, {242, 4}, {243, 4}, {244, 4}, {245, 4}, {246, 4}, {247, 4}, {248, 4}, {249, 4}, {250, 4}, {251, 4}, {252, 4}, {253, 4}, {254, 4}, {255, 4}, {285, 2}, {338, 4}, {339, 4}, {352, 4}, {353, 4}, {376, 4}, {381, 4}, {382, 4}, {3748, 2}, {5024, 2}, {8226, 2}, {8230, 4}, {8364, 4}, {65533, 4}};

View File

@@ -1,81 +1,81 @@
#include "Settings.h"
#include "Preferences.h"
Preferences Settings;
void loadSettings()
{
Settings.begin("awtrix", false);
MATRIX_FPS = Settings.getUChar("FPS", 23);
BRIGHTNESS = Settings.getUChar("BRI", 120);
AUTO_BRIGHTNESS = Settings.getBool("ABRI", true);
TEXTCOLOR_565 = Settings.getUInt("COL", 0xFFFF);
Settings.end();
}
void saveSettings()
{
Settings.begin("awtrix", false);
Settings.putUChar("FPS", MATRIX_FPS);
Settings.putUChar("BRI", BRIGHTNESS);
Settings.putBool("ABRI", AUTO_BRIGHTNESS);
Settings.putUInt("COL", TEXTCOLOR_565);
Settings.end();
}
IPAddress local_IP;
IPAddress gateway;
IPAddress subnet;
IPAddress primaryDNS;
IPAddress secondaryDNS;
const char *VERSION = "0.30";
String MQTT_HOST = "";
uint16_t MQTT_PORT = 1883;
String MQTT_USER;
String MQTT_PASS;
String MQTT_PREFIX = "AwtrixLight";
String CITY = "Berlin,de";
bool IO_BROKER = false;
bool NET_STATIC = false;
bool SHOW_DATE = true;
bool SHOW_WEATHER = true;
bool SHOW_BATTERY = true;
bool SHOW_TEMP = true;
bool SHOW_HUM = true;
bool SHOW_SECONDS = true;
bool SHOW_WEEKDAY = true;
String NET_IP = "192.168.178.10";
String NET_GW = "192.168.178.1";
String NET_SN = "255.255.255.0";
String NET_PDNS = "8.8.8.8";
String NET_SDNS = "1.1.1.1";
int TIME_PER_FRAME = 7000;
uint8_t MATRIX_FPS = 23;
int TIME_PER_TRANSITION = 500;
String NTP_SERVER = "de.pool.ntp.org";
String NTP_TZ = "CET-1CEST,M3.5.0,M10.5.0/3";
bool HA_DISCOVERY = false;
// Periphery
String CURRENT_APP;
float CURRENT_TEMP;
float CURRENT_HUM;
float CURRENT_LUX;
uint8_t BRIGHTNESS = 120;
uint8_t BRIGHTNESS_PERCENT;
uint8_t BATTERY_PERCENT;
String ALARM_SOUND;
uint8_t SNOOZE_TIME;
String TIMER_SOUND;
// Matrix States
bool AUTO_BRIGHTNESS = true;
bool UPPERCASE_LETTERS = true;
bool AP_MODE;
bool MATRIX_OFF;
bool TIMER_ACTIVE;
bool ALARM_ACTIVE;
uint16_t TEXTCOLOR_565 = 0xFFFF;
#include "Globals.h"
#include "Preferences.h"
Preferences Settings;
void loadSettings()
{
Settings.begin("awtrix", false);
MATRIX_FPS = Settings.getUChar("FPS", 23);
BRIGHTNESS = Settings.getUChar("BRI", 120);
AUTO_BRIGHTNESS = Settings.getBool("ABRI", true);
TEXTCOLOR_565 = Settings.getUInt("COL", 0xFFFF);
Settings.end();
}
void saveSettings()
{
Settings.begin("awtrix", false);
Settings.putUChar("FPS", MATRIX_FPS);
Settings.putUChar("BRI", BRIGHTNESS);
Settings.putBool("ABRI", AUTO_BRIGHTNESS);
Settings.putUInt("COL", TEXTCOLOR_565);
Settings.end();
}
IPAddress local_IP;
IPAddress gateway;
IPAddress subnet;
IPAddress primaryDNS;
IPAddress secondaryDNS;
const char *VERSION = "0.30";
String MQTT_HOST = "";
uint16_t MQTT_PORT = 1883;
String MQTT_USER;
String MQTT_PASS;
String MQTT_PREFIX = "AwtrixLight";
String CITY = "Berlin,de";
bool IO_BROKER = false;
bool NET_STATIC = false;
bool SHOW_DATE = true;
bool SHOW_WEATHER = true;
bool SHOW_BATTERY = true;
bool SHOW_TEMP = true;
bool SHOW_HUM = true;
bool SHOW_SECONDS = true;
bool SHOW_WEEKDAY = true;
String NET_IP = "192.168.178.10";
String NET_GW = "192.168.178.1";
String NET_SN = "255.255.255.0";
String NET_PDNS = "8.8.8.8";
String NET_SDNS = "1.1.1.1";
int TIME_PER_FRAME = 7000;
uint8_t MATRIX_FPS = 23;
int TIME_PER_TRANSITION = 500;
String NTP_SERVER = "de.pool.ntp.org";
String NTP_TZ = "CET-1CEST,M3.5.0,M10.5.0/3";
bool HA_DISCOVERY = false;
// Periphery
String CURRENT_APP;
float CURRENT_TEMP;
float CURRENT_HUM;
float CURRENT_LUX;
uint8_t BRIGHTNESS = 120;
uint8_t BRIGHTNESS_PERCENT;
uint8_t BATTERY_PERCENT;
String ALARM_SOUND;
uint8_t SNOOZE_TIME;
String TIMER_SOUND;
// Matrix States
bool AUTO_BRIGHTNESS = true;
bool UPPERCASE_LETTERS = true;
bool AP_MODE;
bool MATRIX_OFF;
bool TIMER_ACTIVE;
bool ALARM_ACTIVE;
uint16_t TEXTCOLOR_565 = 0xFFFF;

View File

@@ -1,59 +1,59 @@
#ifndef SETTINGS_H
#define SETTINGS_H
#include <Arduino.h>
extern const char *VERSION;
extern IPAddress local_IP;
extern IPAddress gateway;
extern IPAddress subnet;
extern IPAddress primaryDNS;
extern IPAddress secondaryDNS;
extern String MQTT_HOST;
extern uint16_t MQTT_PORT;
extern String MQTT_USER;
extern String MQTT_PASS;
extern String MQTT_PREFIX;
extern String CITY;
extern bool IO_BROKER;
extern bool NET_STATIC;
extern bool SHOW_DATE;
extern bool SHOW_WEATHER;
extern bool SHOW_BATTERY;
extern bool SHOW_TEMP;
extern bool SHOW_HUM;
extern bool SHOW_SECONDS;
extern bool SHOW_WEEKDAY;
extern String NET_IP;
extern String NET_GW;
extern String NET_SN;
extern String NET_PDNS;
extern String NET_SDNS;
extern int TIME_PER_FRAME;
extern uint8_t MATRIX_FPS;
extern int TIME_PER_TRANSITION;
extern String NTP_SERVER;
extern String NTP_TZ;
extern bool HA_DISCOVERY;
extern bool UPPERCASE_LETTERS;
extern float CURRENT_TEMP;
extern float CURRENT_HUM;
extern float CURRENT_LUX;
extern String CURRENT_APP;
extern uint8_t BATTERY_PERCENT;
extern uint8_t BRIGHTNESS;
extern uint8_t BRIGHTNESS_PERCENT;
extern String TEXTCOLOR;
extern bool AUTO_BRIGHTNESS;
extern bool AP_MODE;
extern bool ALARM_ACTIVE;
extern bool TIMER_ACTIVE;
extern bool MATRIX_OFF;
extern String ALARM_SOUND;
extern String TIMER_SOUND;
extern uint16_t TEXTCOLOR_565;
extern uint8_t SNOOZE_TIME;
void loadSettings();
void saveSettings();
#ifndef SETTINGS_H
#define SETTINGS_H
#include <Arduino.h>
extern const char *VERSION;
extern IPAddress local_IP;
extern IPAddress gateway;
extern IPAddress subnet;
extern IPAddress primaryDNS;
extern IPAddress secondaryDNS;
extern String MQTT_HOST;
extern uint16_t MQTT_PORT;
extern String MQTT_USER;
extern String MQTT_PASS;
extern String MQTT_PREFIX;
extern String CITY;
extern bool IO_BROKER;
extern bool NET_STATIC;
extern bool SHOW_DATE;
extern bool SHOW_WEATHER;
extern bool SHOW_BATTERY;
extern bool SHOW_TEMP;
extern bool SHOW_HUM;
extern bool SHOW_SECONDS;
extern bool SHOW_WEEKDAY;
extern String NET_IP;
extern String NET_GW;
extern String NET_SN;
extern String NET_PDNS;
extern String NET_SDNS;
extern int TIME_PER_FRAME;
extern uint8_t MATRIX_FPS;
extern int TIME_PER_TRANSITION;
extern String NTP_SERVER;
extern String NTP_TZ;
extern bool HA_DISCOVERY;
extern bool UPPERCASE_LETTERS;
extern float CURRENT_TEMP;
extern float CURRENT_HUM;
extern float CURRENT_LUX;
extern String CURRENT_APP;
extern uint8_t BATTERY_PERCENT;
extern uint8_t BRIGHTNESS;
extern uint8_t BRIGHTNESS_PERCENT;
extern String TEXTCOLOR;
extern bool AUTO_BRIGHTNESS;
extern bool AP_MODE;
extern bool ALARM_ACTIVE;
extern bool TIMER_ACTIVE;
extern bool MATRIX_OFF;
extern String ALARM_SOUND;
extern String TIMER_SOUND;
extern uint16_t TEXTCOLOR_565;
extern uint8_t SNOOZE_TIME;
void loadSettings();
void saveSettings();
#endif // Globals_H

View File

@@ -1,5 +1,5 @@
#include <MQTTManager.h>
#include "Settings.h"
#include "Globals.h"
#include "DisplayManager.h"
#include "ServerManager.h"
#include <ArduinoHA.h>

View File

@@ -1,7 +1,7 @@
#include <MenuManager.h>
#include <Arduino.h>
#include <AudioManager.h>
#include <Settings.h>
#include <Globals.h>
#include <ServerManager.h>
#include <DisplayManager.h>

View File

@@ -1,7 +1,7 @@
#include <PeripheryManager.h>
#include <melody_player.h>
#include <melody_factory.h>
#include "Settings.h"
#include "Globals.h"
#include "DisplayManager.h"
#include "MQTTManager.h"
#include <ArduinoJson.h>

View File

@@ -1,5 +1,5 @@
#include "ServerManager.h"
#include "Settings.h"
#include "Globals.h"
#include <WebServer.h>
#include <esp-fs-webserver.h>
#include "icondownloader.h"
@@ -10,11 +10,6 @@
#include <WiFi.h>
#include "DisplayManager.h"
#include <Preferences.h>
Preferences preferences;
WebServer server(80);
FSWebServer mws(LittleFS, server);
bool FSOPEN;

View File

@@ -36,7 +36,7 @@
#include "PeripheryManager.h"
#include "MQTTManager.h"
#include "ServerManager.h"
#include "Settings.h"
#include "Globals.h"
#include "AudioManager.h"
TaskHandle_t taskHandle;