Skip to content

Commit

Permalink
Better design
Browse files Browse the repository at this point in the history
  • Loading branch information
atc1441 committed Feb 14, 2022
1 parent 27f6e53 commit ddeb3a8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Binary file modified Firmware/ATC_Paper.bin
Binary file not shown.
7 changes: 5 additions & 2 deletions Firmware/src/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ RAM uint16_t battery_mv;
RAM int16_t temperature;

RAM uint8_t count_epd_refresh = 60;
RAM uint8_t hour_refresh = 0;

// Settings
extern settings_struct settings;
Expand Down Expand Up @@ -54,15 +55,17 @@ _attribute_ram_code_ void main_loop(void)
temperature = get_temperature_c();
set_adv_data(temperature, battery_level, battery_mv);
ble_send_battery(battery_level);
ble_send_temp(temperature);
ble_send_temp(EPD_read_temp()*10);
}

if (time_reached_period(Timer_CH_2, 60))
{
count_epd_refresh++;
if (count_epd_refresh > 60)
uint8_t current_hour = ((get_time() / 60) / 60) % 24;
if ((count_epd_refresh > 60) || (current_hour != hour_refresh))
{
count_epd_refresh = 0;
hour_refresh = current_hour;
epd_display(get_time(), battery_mv, temperature, 1);
}
else
Expand Down
8 changes: 3 additions & 5 deletions Firmware/src/epd.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,9 @@ _attribute_ram_code_ void epd_display(uint32_t time_is, uint16_t battery_mv, int

char buff[25];
sprintf(buff, "%02d:%02d", ((time_is / 60) / 60) % 24, (time_is / 60) % 60);
obdWriteStringCustom(&obd, (GFXfont *)&Special_Elite_Regular_30, 10, 45, (char *)buff, 1);
sprintf(buff, "Temperature %d C", temperature);
obdWriteStringCustom(&obd, (GFXfont *)&Dialog_plain_16, 10, 80, (char *)buff, 1);
sprintf(buff, "EPD Temperature %d C", EPD_read_temp());
obdWriteStringCustom(&obd, (GFXfont *)&Dialog_plain_16, 10, 100, (char *)buff, 1);
obdWriteStringCustom(&obd, (GFXfont *)&DSEG14_Classic_Mini_Regular_40, 50, 45, (char *)buff, 1);
sprintf(buff, "%d'C", EPD_read_temp());
obdWriteStringCustom(&obd, (GFXfont *)&Special_Elite_Regular_30, 10, 95, (char *)buff, 1);
sprintf(buff, "Battery %dmV", battery_mv);
obdWriteStringCustom(&obd, (GFXfont *)&Dialog_plain_16, 10, 120, (char *)buff, 1);
FixBuffer(epd_temp, epd_buffer);
Expand Down

0 comments on commit ddeb3a8

Please sign in to comment.