diff --git a/src/Dictionary.cpp b/src/Dictionary.cpp index 307be12..721bca3 100644 --- a/src/Dictionary.cpp +++ b/src/Dictionary.cpp @@ -106,8 +106,10 @@ const char HAramClass[] PROGMEM = {"data_size"}; const char HAramUnit[] PROGMEM = {"B"}; // JSON properites +#ifdef ULANZI const char BatKey[] PROGMEM = {"bat"}; const char BatRawKey[] PROGMEM = {"bat_raw"}; +#endif const char LuxKey[] PROGMEM = {"lux"}; const char LDRRawKey[] PROGMEM = {"ldr_raw"}; const char BrightnessKey[] PROGMEM = {"bri"}; diff --git a/src/Dictionary.h b/src/Dictionary.h index 3993788..1b44a63 100644 --- a/src/Dictionary.h +++ b/src/Dictionary.h @@ -106,8 +106,10 @@ extern const char HAramClass[]; extern const char HAramUnit[]; // JSON properites +#ifdef ULANZI extern const char BatKey[]; extern const char BatRawKey[]; +#endif extern const char LuxKey[]; extern const char LDRRawKey[]; extern const char BrightnessKey[]; diff --git a/src/DisplayManager.cpp b/src/DisplayManager.cpp index 26be5e3..3531254 100644 --- a/src/DisplayManager.cpp +++ b/src/DisplayManager.cpp @@ -266,7 +266,11 @@ void DisplayManager_::generateCustomPage(String name, const char *json) if (doc.containsKey("sound")) { +#ifdef ULANZI customApp.sound = ("/" + doc["sound"].as() + ".txt"); +#else + customApp.sound = doc["sound"].as(); +#endif } else { @@ -820,17 +824,13 @@ void DisplayManager_::updateAppVector(const char *json) callback = HumApp; SHOW_HUM = show; } - #ifdef ULANZI - else if (name == "bat") { callback = BatApp; SHOW_BAT = show; } - #endif - else { // If the app is not one of the built-in apps, check if it's already in the vector diff --git a/src/Globals.cpp b/src/Globals.cpp index abdc1d4..6632adb 100644 --- a/src/Globals.cpp +++ b/src/Globals.cpp @@ -19,7 +19,9 @@ void startLittleFS() { if (LittleFS.begin()) { +#ifdef ULANZI LittleFS.mkdir("/MELODIES"); +#endif LittleFS.mkdir("/ICONS"); } else @@ -32,7 +34,7 @@ void startLittleFS() void loadDevSettings() { - Serial.println("laodSettings"); + Serial.println("loadSettings"); File file = LittleFS.open("/dev.json", "r"); if (!file) { @@ -185,7 +187,7 @@ bool ALARM_ACTIVE; uint16_t TEXTCOLOR_565 = 0xFFFF; bool SOUND_ACTIVE; String BOOT_SOUND = ""; -uint8_t VOLUME; -uint8_t VOLUME_PERCENT; +uint8_t VOLUME_PERCENT = 50; +uint8_t VOLUME = map(VOLUME_PERCENT, 0, 100, 0, 30); int MATRIX_LAYOUT; bool UPDATE_AVAILABLE = false; \ No newline at end of file diff --git a/src/Globals.h b/src/Globals.h index db7f469..146baba 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -68,8 +68,8 @@ extern bool START_ON_MONDAY; extern bool IS_CELSIUS; extern bool SOUND_ACTIVE; extern String BOOT_SOUND; -extern uint8_t VOLUME; extern uint8_t VOLUME_PERCENT; +extern uint8_t VOLUME; extern int MATRIX_LAYOUT; extern bool UPDATE_AVAILABLE; void loadSettings(); diff --git a/src/MQTTManager.cpp b/src/MQTTManager.cpp index 4fb2ae0..2361248 100644 --- a/src/MQTTManager.cpp +++ b/src/MQTTManager.cpp @@ -357,16 +357,16 @@ void MQTTManager_::setup() humidity->setName(HAhumName); humidity->setDeviceClass(HAhumClass); humidity->setUnitOfMeasurement(HAhumUnit); - #ifdef ULANZI + sprintf(batID, HAbatID, macStr); battery = new HASensor(batID); battery->setIcon(HAbatIcon); battery->setName(HAbatName); battery->setDeviceClass(HAbatClass); battery->setUnitOfMeasurement(HAbatUnit); -#endif +#endif sprintf(luxID, HAluxID, macStr); illuminance = new HASensor(luxID); illuminance->setIcon(HAluxIcon); @@ -455,8 +455,8 @@ void MQTTManager_::sendStats() #ifdef ULANZI snprintf(buffer, 5, "%d", BATTERY_PERCENT); battery->setValue(buffer); -#endif +#endif snprintf(buffer, 5, "%.0f", CURRENT_TEMP); temperature->setValue(buffer); diff --git a/src/PeripheryManager.cpp b/src/PeripheryManager.cpp index 808e5f0..66741ef 100644 --- a/src/PeripheryManager.cpp +++ b/src/PeripheryManager.cpp @@ -153,12 +153,14 @@ void PeripheryManager_::playBootSound() if (BOOT_SOUND == "") { #ifdef ULANZI - // no standardsound + // no standard sound const int nNotes = 6; String notes[nNotes] = {"E5", "C5", "G4", "E4", "G4", "C5"}; const int timeUnit = 150; Melody melody = MelodyFactory.load("Bootsound", timeUnit, notes, nNotes); player.playAsync(melody); +#else + playFromFile(DFMINI_MP3_BOOT); #endif } else @@ -166,7 +168,7 @@ void PeripheryManager_::playBootSound() #ifdef ULANZI playFromFile("/MELODIES/" + BOOT_SOUND + ".txt"); #else - dfmp3.playMp3FolderTrack(BOOT_SOUND.toInt()); + playFromFile(BOOT_SOUND); #endif } } @@ -242,7 +244,7 @@ void PeripheryManager_::setup() #else dfmp3.begin(); delay(50); - dfmp3.setVolume(20); // Set initial value to saved setting MISSING! + setVolume(VOLUME); #endif button_left.begin(); button_right.begin(); diff --git a/src/UpdateManager.cpp b/src/UpdateManager.cpp index b1a8f88..53307bc 100644 --- a/src/UpdateManager.cpp +++ b/src/UpdateManager.cpp @@ -8,8 +8,13 @@ #include #include "Globals.h" +#ifdef ULANZI #define URL_fw_Version "https://raw.githubusercontent.com/Blueforcer/awtrix-light/main/version" #define URL_fw_Bin "https://raw.githubusercontent.com/Blueforcer/awtrix-light/main/docs/flasher/firmware/firmware.bin" +#else +#define URL_fw_Version "todo" +#define URL_fw_Bin "todo" +#endif Ticker UpdateTicker;