28 lines
582 B
C++
28 lines
582 B
C++
|
|
#include <ViewStates.h>
|
|
|
|
ViewTemperatureState::ViewTemperatureState(DS3231 &_ds3231, AT24C32 &_at24c32) : ViewTextState(at24c32)
|
|
{
|
|
ds3231 = _ds3231;
|
|
at24c32 = _at24c32;
|
|
};
|
|
|
|
void ViewTemperatureState::render(uint8_t matrix[121], ControlStates controlState)
|
|
{
|
|
// °
|
|
matrix[9] = color;
|
|
matrix[10] = color;
|
|
matrix[20] = color;
|
|
matrix[21] = color;
|
|
|
|
int temperature = floor(ds3231.getTemperature());
|
|
|
|
length = 2;
|
|
|
|
text[0] = (temperature / 10) + 0x30;
|
|
text[1] = (temperature % 10) + 0x30;
|
|
|
|
ViewTextState::writeChars(matrix);
|
|
|
|
renderBinaryClock(matrix, ds3231);
|
|
} |