mirror of
https://github.com/mfactory-osaka/ESPTimeCast.git
synced 2026-04-03 03:00:24 -04:00
v1.5.0 — Action API, Physical Button & WiFi Improvements ⚡ New: Unified `/action` API: - New `/action` endpoint replaces individual `/set_*` endpoints (legacy endpoints still supported) - Device control via HTTP GET or POST: messages, brightness, navigation, timers, toggles, and more - Toggle behavior: sending a parameter without a value toggles it and jumps to the relevant mode - Explicit value behavior: sending `=0` or `=1` sets without disrupting the display - All boolean settings now controllable via API: `twelvehour`, `dayofweek`, `showdate`, `colon_blink`, `humidity`, `weatherdesc`, `units`, `countdown`, `flip`, `clock_only_dimming` - Navigation actions: `next_mode`, `prev_mode`, `go_to_mode` (by number or name) - Brightness actions: `brightness`, `brightness_up`, `brightness_down`, `display_off` - Rotation control: `enable_rotation` — freeze or resume automatic mode rotation - System actions: `save`, `restart`, `clear_message`, `language` - Timer actions: `timer`, `timer_stop`, `timer_cancel`, `timer_pause`, `timer_resume`, `timer_start`, `timer_restart` - Message aliases: `scrolltimes`, `scrolls`, `scroll_times` all accepted - `clear_message` correctly restores the persistent Web UI message 🔘 New: Physical Button Template - Optional physical button support — disabled by default, uncomment to enable - Short press: advance to next mode (customizable) - Long press (800ms): toggle display on/off (customizable) - Uses internal pull-up — no external resistor needed - Any action from the `/action` API can be assigned to either press - Full documentation and wiring guide added to README 📶 Improved: WiFi Reconnection - New exponential backoff reconnection system - Reconnect attempts: 5s → 10s → 20s → 40s → 80s → 160s → 300s (caps at 5 min) - Prevents hammering the router with rapid reconnection attempts - `WiFi.setAutoReconnect(false)` — manual backoff now handles all reconnection - ESP8266 uses `WiFi.begin(ssid, password)` for reconnection (ESP32 uses `WiFi.reconnect()`) - Logs connection loss, reconnection attempts, and successful reconnection - mDNS restarts automatically after reconnection - Weather fetch deferred briefly after reconnection to let network stabilize 🌐 ESPTimeCast Companion Extension - New browser extension available on the Chrome Web Store - Automatically detects and displays media titles from YouTube, Spotify, Prime Video, Twitch, Vimeo, Dailymotion, and SoundCloud - Control brightness, modes, and rotation directly from the popup - Cast to multiple ESPTimeCast devices simultaneously - Requires **v1.5.0 or later** (uses the new `/action` endpoint) 🎨 Font Changes - `mfactoryfont.h` is now bundled directly with the firmware following the license change - No separate font download required — the custom font is included out of the box - Basic Font has been removed — all builds now use the full `mfactoryfont.h` - All icons, weather symbols, and custom glyphs available on all installations 📜 License Change - ESPTimeCast is no longer licensed under GPL-3.0 - New license: Source-available for personal, non-commercial use only - Personal use includes home, hobby, and small non-commercial settings - Forking permitted with license retained - Commercial licensing available — contact mario.felipe.tf@gmail.com - Previous versions (v1.4.2 and earlier) remain under GPL-3.0 ### 📖 Documentation - Full API reference added to README covering all `/action` parameters - Physical button wiring guide and customization examples - WiFi reconnection behavior documented - Timer documentation added (moved from HA section to standalone section) - Chrome Extension section added to README - Legacy endpoint note added for `/set_custom_message` and `/set_brightness`
62 lines
2.6 KiB
C
62 lines
2.6 KiB
C
/*
|
||
ESPTimeCast™
|
||
|
||
Copyright (c) 2026 M-Factory
|
||
|
||
This software is source-available for personal, non-commercial use only.
|
||
It is not open source.
|
||
|
||
See LICENSE.txt for full terms.
|
||
*/
|
||
|
||
#ifndef DAYS_LOOKUP_H
|
||
#define DAYS_LOOKUP_H
|
||
|
||
typedef struct {
|
||
const char* lang;
|
||
const char* days[7];
|
||
} DaysOfWeekMapping;
|
||
|
||
const DaysOfWeekMapping days_mappings[] = {
|
||
{ "af", { "son", "maa", "din", "woe", "don", "vry", "sat" } },
|
||
{ "cs", { "ned", "pon", "ute", "str", "ctv", "pat", "sob" } },
|
||
{ "da", { "son", "man", "tir", "ons", "tor", "fre", "lor" } },
|
||
{ "de", { "so", "mo", "di", "mi", "do", "fr", "sa" } },
|
||
{ "en", { "sun", "mon", "tue", "wed", "thu", "fri", "sat" } },
|
||
{ "eo", { "dim", "lun", "mar", "mer", "jau", "ven", "sab" } },
|
||
{ "es", { "dom", "lun", "mar", "mie", "jue", "vie", "sab" } },
|
||
{ "et", { "pu", "es", "te", "ko", "ne", "re", "la" } },
|
||
{ "fi", { "sun", "maa", "tis", "kes", "tor", "per", "lau" } },
|
||
{ "fr", { "dim", "lun", "mar", "mer", "jeu", "ven", "sam" } },
|
||
{ "ga", { "dom", "lua", "mai", "cea", "dea", "aoi", "sat" } },
|
||
{ "hr", { "ned", "pon", "uto", "sri", "cet", "pet", "sub" } },
|
||
{ "hu", { "vas", "het", "ked", "sze", "csu", "pen", "szo" } },
|
||
{ "it", { "dom", "lun", "mar", "mer", "gio", "ven", "sab" } },
|
||
{ "ja", { "±", "²", "³", "´", "µ", "¶", "·" } },
|
||
{ "lt", { "sek", "pir", "ant", "tre", "ket", "pen", "ses" } },
|
||
{ "lv", { "sve", "pir", "otr", "tre", "cet", "pie", "ses" } },
|
||
{ "nl", { "zon", "maa", "din", "woe", "don", "vri", "zat" } },
|
||
{ "no", { "son", "man", "tir", "ons", "tor", "fre", "lor" } },
|
||
{ "pl", { "nie", "pon", "wto", "sro", "czw", "pia", "sob" } },
|
||
{ "pt", { "dom", "seg", "ter", "qua", "qui", "sex", "sab" } },
|
||
{ "ro", { "dum", "lun", "mar", "mie", "joi", "vin", "sam" } },
|
||
{ "ru", { "bc", "nh", "bt", "cp", "\x84t", "nt", "c\x85" } },
|
||
{ "sk", { "ned", "pon", "uto", "str", "stv", "pia", "sob" } },
|
||
{ "sl", { "ned", "pon", "tor", "sre", "cet", "pet", "sob" } },
|
||
{ "sr", { "ned", "pon", "uto", "sre", "cet", "pet", "sub" } },
|
||
{ "sv", { "son", "man", "tis", "ons", "tor", "fre", "lor" } },
|
||
{ "sw", { "jpi", "jta", "jnn", "jta", "alh", "ljm", "jmo" } },
|
||
{ "tr", { "paz", "pzt", "sal", "car", "per", "cum", "cmt" } }
|
||
};
|
||
|
||
#define DAYS_MAPPINGS_COUNT (sizeof(days_mappings)/sizeof(days_mappings[0]))
|
||
|
||
inline const char* const* getDaysOfWeek(const char* lang) {
|
||
for (size_t i = 0; i < DAYS_MAPPINGS_COUNT; i++) {
|
||
if (strcmp(lang, days_mappings[i].lang) == 0)
|
||
return days_mappings[i].days;
|
||
}
|
||
return days_mappings[4].days; // fallback "en"
|
||
}
|
||
|
||
#endif |