fix: builtin aliases, cmd version default, relay compat, NTP UTC, player guards

BuiltInMelodies (F-018):
- 24 builtin_* UID aliases added for backward compat with old device PIDs
- Two new PROGMEM arrays: builtin_catehetical, builtin_mournfull_toll_alternative
- isBuiltInMelody() helper for lightweight PID existence check
- FileManager download-skip now uses isBuiltInMelody() instead of findMelodyByPID()

Command envelope version default (F-020):
- MQTT, UART, WebSocket transports: missing "v" field defaults to 1 (was 2)
- Fixes legacy adapter rejecting commands from app and Node-RED

RelayHandler v1/v2 compat (F-021):
- set_durations and set_outputs accept both nested {"bells":{...}} (v2)
  and flat {...} (v1) payload shapes

NTP UTC fix (F-019):
- configTime(0,0,ntpServer) fetches raw UTC; stored gmtOffset+dstOffset
  applied manually to epoch before writing RTC
- Eliminates double-offset bug from SDK internal timezone handling

Player guards (F-022):
- speed==0 defaults to 300ms instead of producing silent/broken playback
- calculateProjectedRunTime() guards against singleLoopDuration==0

Telemetry (F-023):
- bellMaxLoad default raised 200→500 to eliminate false overload warnings

Version bump: 2.0.1 → 2.0.3

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-30 09:52:39 +03:00
co-authored by Claude Sonnet 4.6
parent df8426fce6
commit 7e8d91673f
11 changed files with 205 additions and 32 deletions
+67 -4
View File
@@ -24,9 +24,9 @@
* - Bit 0-15: Which bells/notes to activate
* - Example: 0x0001 = Bell 0, 0x0003 = Bells 0+1, 0x8000 = Bell 15
*
* 📋 VERSION: 1.0
* 📅 DATE: 2025-12-28
* 👨‍💻 AUTHOR: Advanced Bell Systems
* 📋 VERSION: 1.1
* 📅 DATE: 2026-03-19
* 👨‍💻 AUTHOR: bonamin
* ═══════════════════════════════════════════════════════════════════════════════════
*/
@@ -330,6 +330,27 @@ const uint16_t PROGMEM doxology_1_4[] = {
};
// ═════════════════════════════════════════════════════════════════════════════════
// PROGMEM for builtin_* UIDs that have no identical current array
// ═════════════════════════════════════════════════════════════════════════════════
// builtin_catehetical: same as catechetical_1_5 but without trailing 0x0000
const uint16_t PROGMEM builtin_catehetical[] = {
0x0001, 0x0002, 0x0004, 0x0008, 0x0010
};
// builtin_mournfull_toll_alternative: unique doubled-beat pattern
const uint16_t PROGMEM builtin_mournfull_toll_alternative[] = {
0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001,
0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0004,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0004, 0x0004,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 0x0002, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0008, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000
};
// ═════════════════════════════════════════════════════════════════════════════════
// MELODY LIBRARY - Array of all built-in melodies
// ═════════════════════════════════════════════════════════════════════════════════
@@ -490,7 +511,35 @@ const MelodyInfo MELODY_LIBRARY[] = {
"doxology_1_4",
doxology_1_4,
sizeof(doxology_1_4) / sizeof(uint16_t)
}
},
// ── builtin_* UIDs — backward-compat aliases for devices using old PIDs ──────
{ "1 Bell Test", "builtin_1bell_test", one_bell_test, sizeof(one_bell_test) / sizeof(uint16_t) },
{ "Doxology Traditional", "builtin_doxology_traditional", doxology_1_4, sizeof(doxology_1_4) / sizeof(uint16_t) },
{ "Doxology Alternative", "builtin_doxology_alternative", doxology_alt_1_5, sizeof(doxology_alt_1_5) / sizeof(uint16_t) },
{ "Doxology Festive", "builtin_doxology_festive", doxology_fst_1_6, sizeof(doxology_fst_1_6) / sizeof(uint16_t) },
{ "Vesper Traditional", "builtin_vesper_traditional", vesper_1_3, sizeof(vesper_1_3) / sizeof(uint16_t) },
{ "Vesper Alternative", "builtin_vesper_alternative", vesper_fst_1_4, sizeof(vesper_fst_1_4) / sizeof(uint16_t) },
{ "Catehetical", "builtin_catehetical", builtin_catehetical, sizeof(builtin_catehetical) / sizeof(uint16_t) },
{ "Orthros Traditional", "builtin_orthros_traditional", orthros_1_8, sizeof(orthros_1_8) / sizeof(uint16_t) },
{ "Orthros Alternative", "builtin_orthros_alternative", orthros_fst_1_3, sizeof(orthros_fst_1_3) / sizeof(uint16_t) },
{ "Mournfull Toll", "builtin_mournfull_toll", mournfull_1_4, sizeof(mournfull_1_4) / sizeof(uint16_t) },
{ "Mournfull Toll Alternative", "builtin_mournfull_toll_alternative", builtin_mournfull_toll_alternative, sizeof(builtin_mournfull_toll_alternative) / sizeof(uint16_t) },
{ "Mournfull Toll Meg Par", "builtin_mournfull_toll_meg_par", mournfull_gf_1_4, sizeof(mournfull_gf_1_4) / sizeof(uint16_t) },
{ "Sematron", "builtin_sematron", semantron_1_4, sizeof(semantron_1_4) / sizeof(uint16_t) },
{ "Sematron Alternative", "builtin_sematron_alternative", talanto_1_4, sizeof(talanto_1_4) / sizeof(uint16_t) },
{ "Athonite 1 2 Voices", "builtin_athonite_1_2_voices", athonite_1_2, sizeof(athonite_1_2) / sizeof(uint16_t) },
{ "Athonite 3 Voices", "builtin_athonite_3_voices", athonite_3, sizeof(athonite_3) / sizeof(uint16_t) },
{ "Athonite 3 4 Voices", "builtin_athonite_3_4_voices", athonite_3_4, sizeof(athonite_3_4) / sizeof(uint16_t) },
{ "Athonite 4 8 Voices", "builtin_athonite_4_8_voices", athonite_4_8, sizeof(athonite_4_8) / sizeof(uint16_t) },
{ "Onebyone 2 3 Voices", "builtin_onebyone_2_3_voices", onebyone_2_3, sizeof(onebyone_2_3) / sizeof(uint16_t) },
{ "Onebyone 4 8 Voices", "builtin_onebyone_4_8_voices", onebyone_4_8, sizeof(onebyone_4_8) / sizeof(uint16_t) },
{ "Festive 1Voice", "builtin_festive_1voice", festive_1, sizeof(festive_1) / sizeof(uint16_t) },
{ "Festive 4Voices", "builtin_festive_4voices", festive_2_4, sizeof(festive_2_4) / sizeof(uint16_t) },
{ "Festive 5Voices", "builtin_festive_5voices", festive_5, sizeof(festive_5) / sizeof(uint16_t) },
{ "Festive 5Voice Alternative", "builtin_festive_5voice_alternative", festive_alt_5, sizeof(festive_alt_5) / sizeof(uint16_t) },
{ "Festive 6Voices", "builtin_festive_6voices", festive_6, sizeof(festive_6) / sizeof(uint16_t) },
{ "Festive 8Voices", "builtin_festive_8voices", festive_1_8, sizeof(festive_1_8) / sizeof(uint16_t) },
{ "Ormilia", "builtin_ormilia", ormilia_1_8, sizeof(ormilia_1_8) / sizeof(uint16_t) }
};
@@ -501,6 +550,20 @@ const uint16_t MELODY_COUNT = sizeof(MELODY_LIBRARY) / sizeof(MelodyInfo);
// HELPER FUNCTIONS
// ═════════════════════════════════════════════════════════════════════════════════
/**
* @brief Check if a PID corresponds to a built-in melody
* @param pid The melody PID to check
* @return true if the PID exists in the built-in melody library
*/
inline bool isBuiltInMelody(const String& pid) {
for (uint16_t i = 0; i < MELODY_COUNT; i++) {
if (pid == MELODY_LIBRARY[i].pid) {
return true;
}
}
return false;
}
/**
* @brief Find a built-in melody by PID
* @param pid The melody playback ID to find