You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HomeActivity.cpp 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include "HomeActivity.h"
  2. #include "Boiler.h"
  3. #include "defines.h"
  4. #include "Helpers.h"
  5. #include "Logs.h"
  6. #include "globals.h"
  7. #include "BaseActivity.h"
  8. HomeActivity::HomeActivity()
  9. : BaseActivity(nullptr, &g_menuWaterActivity)
  10. {
  11. }
  12. void HomeActivity::getLcdText(char** lines)
  13. {
  14. getLineText(lines[0], 'S', &g_appState.tanks[0]);
  15. getLineText(lines[1], 'C', &g_appState.tanks[1]);
  16. }
  17. void HomeActivity::getLineText(
  18. char* line
  19. , char prefix
  20. , const BoilerTankState* boilerItemState
  21. )
  22. {
  23. char curTmp[7], setTmp[7];
  24. Helpers::tempToStr(curTmp, boilerItemState->input->getValue(), 5);
  25. Helpers::tempToStr(setTmp,
  26. boilerItemState->mode == BoilerTankState::Auto ? boilerItemState->setting : TEMP_T_INVALID, 4);
  27. snprintf(line, 17, "%c:%s [%s] %c", prefix, curTmp, setTmp,
  28. boilerItemState->relay->isEnabled() ? LCD_CHAR_SENSOR : ' ');
  29. }
  30. void HomeActivity::loop()
  31. {
  32. if (g_appState.tanks[0].input->hasChanged() || g_appState.tanks[1].input->hasChanged())
  33. {
  34. LOG(1, "HomeActivity: Input has changed");
  35. m_lcdUpdateNeeded = true;
  36. }
  37. BaseActivity::loop();
  38. }