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.

27 lines
582 B

5 years ago
  1. #include <ViewStates.h>
  2. ViewTemperatureState::ViewTemperatureState(DS3231 &_ds3231, AT24C32 &_at24c32) : ViewTextState(at24c32)
  3. {
  4. ds3231 = _ds3231;
  5. at24c32 = _at24c32;
  6. };
  7. void ViewTemperatureState::render(uint8_t matrix[121], ControlStates controlState)
  8. {
  9. // °
  10. matrix[9] = color;
  11. matrix[10] = color;
  12. matrix[20] = color;
  13. matrix[21] = color;
  14. int temperature = floor(ds3231.getTemperature());
  15. length = 2;
  16. text[0] = (temperature / 10) + 0x30;
  17. text[1] = (temperature % 10) + 0x30;
  18. ViewTextState::writeChars(matrix);
  19. renderBinaryClock(matrix, ds3231);
  20. }