Skip to content

Commit

Permalink
code cleanup and lib updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieucarbou committed Dec 30, 2024
1 parent 26cbc8f commit 58d971a
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion include/i18n/en.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
#define YASOLR_LBL_121 "PZEM (TX) Serial RX"
#define YASOLR_LBL_122 "PZEM (RX) Serial TX"
#define YASOLR_LBL_123 "Pending"
#define YASOLR_LBL_124 "Not started"
#define YASOLR_LBL_124 "Restart required / Failed to start"
#define YASOLR_LBL_125 "Zero-Cross Detection"
#define YASOLR_LBL_126 "Hardware"
#define YASOLR_LBL_129 "LEDs"
Expand Down
2 changes: 1 addition & 1 deletion include/i18n/fr.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
#define YASOLR_LBL_121 "PZEM (TX) Serial RX"
#define YASOLR_LBL_122 "PZEM (RX) Serial TX"
#define YASOLR_LBL_123 "En attente"
#define YASOLR_LBL_124 "Non démarré"
#define YASOLR_LBL_124 "Redémarrage requis / En erreur"
#define YASOLR_LBL_125 "Détection de passage par zéro"
#define YASOLR_LBL_126 "Matériel"
#define YASOLR_LBL_127 "Écran"
Expand Down
4 changes: 2 additions & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ lib_deps =
mathieucarbou/MycilaPZEM004Tv3 @ 5.0.0
mathieucarbou/MycilaRelay @ 4.0.1
mathieucarbou/MycilaSystem @ 4.0.0
mathieucarbou/MycilaTaskManager @ 3.1.5
mathieucarbou/MycilaTaskMonitor @ 3.0.2
mathieucarbou/MycilaTaskManager @ 3.2.1
mathieucarbou/MycilaTaskMonitor @ 4.0.0
mathieucarbou/MycilaTrafficLight @ 2.0.2
mathieucarbou/MycilaUtilities @ 3.1.3
lib_ignore =
Expand Down
1 change: 0 additions & 1 deletion src/todo/yasolr_router.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,5 @@ void yasolr_init_router() {
if (config.getBool(KEY_ENABLE_DEBUG)) {
calibrationTask.enableProfiling(10, Mycila::TaskTimeUnit::MILLISECONDS);
relayTask.enableProfiling(10, Mycila::TaskTimeUnit::MILLISECONDS);
routerTask.enableProfiling(10, Mycila::TaskTimeUnit::MILLISECONDS);
}
}
14 changes: 6 additions & 8 deletions src/yasolr_dashboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ dash::PushButtonCard _restart(dashboard, YASOLR_LBL_082);
dash::PushButtonCard _safeBoot(dashboard, YASOLR_LBL_081);
dash::PushButtonCard _energyReset(dashboard, YASOLR_LBL_085);
dash::PushButtonCard _reset(dashboard, YASOLR_LBL_086);
dash::SwitchCard _debugMode(dashboard, YASOLR_LBL_083);
dash::LinkCard<const char*> _consoleLink(dashboard, YASOLR_LBL_084);
dash::LinkCard<const char*> _debugInfo(dashboard, YASOLR_LBL_178);

Expand Down Expand Up @@ -235,6 +234,7 @@ dash::FeedbackTextInputCard<int32_t> _pinDS18Router(dashboard, YASOLR_LBL_139);
dash::FeedbackTextInputCard<int32_t> _pinZCD(dashboard, YASOLR_LBL_125);

dash::Tab _hardwareEnableTab(dashboard, "\u2699 " YASOLR_LBL_126);
dash::FeedbackSwitchCard _debugMode(dashboard, YASOLR_LBL_083);
dash::FeedbackSwitchCard _display(dashboard, YASOLR_LBL_127);
dash::FeedbackSwitchCard _jsy(dashboard, YASOLR_LBL_128);
dash::FeedbackSwitchCard _jsyRemote(dashboard, YASOLR_LBL_187);
Expand Down Expand Up @@ -482,14 +482,11 @@ void YaSolR::Website::begin() {
_configRestore.setTab(_managementTab);
_consoleLink.setTab(_managementTab);
_debugInfo.setTab(_managementTab);
_debugMode.setTab(_managementTab);
_safeBoot.setTab(_managementTab);
_reset.setTab(_managementTab);
_restart.setTab(_managementTab);
_energyReset.setTab(_managementTab);

_boolConfig(_debugMode, KEY_ENABLE_DEBUG);

_energyReset.onPush([]() {
if (jsy)
jsy->resetEnergy();
Expand Down Expand Up @@ -619,6 +616,7 @@ void YaSolR::Website::begin() {

// Hardware

_debugMode.setTab(_hardwareEnableTab);
_display.setTab(_hardwareEnableTab);
_jsy.setTab(_hardwareEnableTab);
_jsyRemote.setTab(_hardwareEnableTab);
Expand All @@ -637,6 +635,7 @@ void YaSolR::Website::begin() {
_routerDS18.setTab(_hardwareEnableTab);
_zcd.setTab(_hardwareEnableTab);

_boolConfig(_debugMode, KEY_ENABLE_DEBUG);
_boolConfig(_display, KEY_ENABLE_DISPLAY);
_boolConfig(_jsy, KEY_ENABLE_JSY);
_boolConfig(_jsyRemote, KEY_ENABLE_JSY_REMOTE);
Expand Down Expand Up @@ -967,15 +966,13 @@ void YaSolR::Website::initCards() {

// management

const bool debug = config.getBool(KEY_ENABLE_DEBUG);
_configBackup.setValue("/api/config/backup");
_configRestore.setValue("/api/config/restore");
_consoleLink.setValue("/console");
_debugInfo.setValue("/api/debug");
_debugMode.setValue(debug);
_energyReset.setDisplay(jsyEnabled || pzem1Enabled || pzem2Enabled);
_consoleLink.setDisplay(debug);
_debugInfo.setDisplay(debug);
_consoleLink.setDisplay(logger.isDebugEnabled());
_debugInfo.setDisplay(logger.isDebugEnabled());

// network

Expand Down Expand Up @@ -1040,6 +1037,7 @@ void YaSolR::Website::initCards() {

// Hardware

_status(_debugMode, KEY_ENABLE_DEBUG, logger.isDebugEnabled());
_status(_display, KEY_ENABLE_DISPLAY, display && display->isEnabled());
_status(_jsyRemote, KEY_ENABLE_JSY_REMOTE, udp && udp->connected());
_status(_led, KEY_ENABLE_LIGHTS, lights.isEnabled());
Expand Down
2 changes: 1 addition & 1 deletion src/yasolr_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void yasolr_init_display() {
displayCarouselTask->setIntervalSupplier([]() { return config.getLong(KEY_DISPLAY_SPEED) * Mycila::TaskDuration::SECONDS; });
displayCarouselTask->setManager(coreTaskManager);

displayTask->setInterval(500 * Mycila::TaskDuration::MILLISECONDS);
displayTask->setInterval(1000 * Mycila::TaskDuration::MILLISECONDS);
displayTask->setManager(coreTaskManager);
if (config.getBool(KEY_ENABLE_DEBUG))
displayTask->enableProfiling(10, Mycila::TaskTimeUnit::MILLISECONDS);
Expand Down
2 changes: 0 additions & 2 deletions src/yasolr_logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ void yasolr_init_logging() {
loggingTask->setInterval(20 * Mycila::TaskDuration::SECONDS);
loggingTask->enableProfiling(10, Mycila::TaskTimeUnit::MILLISECONDS);
loggingTask->setManager(unsafeTaskManager);

Mycila::TaskMonitor.begin();
} else {
logger.setLevel(ARDUHAL_LOG_LEVEL_INFO);
esp_log_level_set("*", static_cast<esp_log_level_t>(ARDUHAL_LOG_LEVEL_INFO));
Expand Down

0 comments on commit 58d971a

Please sign in to comment.