Skip to content

Commit

Permalink
Split of Nightscout read and display code (this should allow simpler …
Browse files Browse the repository at this point in the history
…user display code update and more different "faces" from users).

New concept of display pages (different display designs, information, faces).
Switch page by short press of the right button.
Power OFF by the right button long press (4 seconds).
Right button works also as power ON after power off by this button.
New page added with large simple info (large BG, clock, delta + arrow and  few icons only).
New M5NS.INI key "default_page" added (default 0).
Smaller WiFi symbol (now as blue WiFi icon in 2 sizes for the 2 different Nightscout queries).
Buttons do not work during Nightscout communication (blue WiFi symbol displayed).
Bigger delta value even with COB+IOB values displayed (COB: and IOB: shortened to C: and I: ).
Errors now logged silently (log can be displayed as the last page).
Warning triangle icon added to show that errors are in the log (up to 5 errors - grey, more - yellow). Only last 10 errors can be displayed.
New M5NS.INI key "restart_at_time" added (default no restart) to restart M5Stack regularly at predefined time to reconnect to WiFi access point and clear possible other errors. No startup sound during soft restart, snooze state reapplied, errors cleared.
New M5NS.INI key "restart_at_logged_errors" added (default no restart) to restart M5Stack after predefined amount of errors logged in error log to reconnect to WiFi access point and clear possible other errors. No startup sound during soft restart, snooze state reapplied, errors cleared.
Right button power icon changed to door icon to better express the page change/power off functions.
  • Loading branch information
Martin8bity committed Jun 20, 2019
1 parent cdb4923 commit 7ae320f
Show file tree
Hide file tree
Showing 6 changed files with 964 additions and 579 deletions.
Binary file modified Binaries/M5_NightscoutMon.ino.bin
Binary file not shown.
34 changes: 32 additions & 2 deletions M5NSconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,36 @@ void readConfiguration(char *iniFilename, tConfig *cfg) {
cfg->show_mgdl = 0;
}

if (ini.getValue("config", "default_page", buffer, bufferLen)) {
Serial.print("default_page = ");
cfg->default_page = atoi(buffer);
Serial.println(cfg->default_page);
}
else {
Serial.println("NO default page defined -> page 0 is default");
cfg->default_page = 0;
}

if (ini.getValue("config", "restart_at_time", buffer, bufferLen)) {
Serial.print("restart_at_time = ");
strlcpy(cfg->restart_at_time, buffer, 10);
Serial.println(cfg->restart_at_time);
}
else {
Serial.println("NO restart_at_time defined -> no restarts");
strcpy(cfg->restart_at_time, "NORES");
}

if (ini.getValue("config", "restart_at_logged_errors", buffer, bufferLen)) {
Serial.print("restart_at_logged_errors = ");
cfg->restart_at_logged_errors = atoi(buffer);
Serial.println(cfg->restart_at_logged_errors);
}
else {
Serial.println("NO restart_at_logged_errors defined -> no restarts");
cfg->restart_at_logged_errors = 0;
}

if (ini.getValue("config", "show_current_time", buffer, bufferLen)) {
Serial.print("show_current_time = ");
cfg->show_current_time = atoi(buffer);
Expand Down Expand Up @@ -317,8 +347,8 @@ void readConfiguration(char *iniFilename, tConfig *cfg) {
Serial.println(cfg->snd_alarm_at_startup);
}
else {
Serial.println("NO snd_alarm_at_startup defined -> enable alarm sound at startup");
cfg->snd_alarm_at_startup = 1;
Serial.println("NO snd_alarm_at_startup defined -> disable alarm sound at startup");
cfg->snd_alarm_at_startup = 0;
}

if (ini.getValue("config", "warning_music", buffer, bufferLen)) {
Expand Down
7 changes: 4 additions & 3 deletions M5NSconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@

struct tConfig {
char url[64];
// begin Peter Leimbach
char token[32]; // security token
// end Peter Leimbach
char bootPic[64];
char userName[32];
int timeZone = 3600; // time zone offset in hours, must be corrected for internatinal use and DST
int dst = 0; // DST time offset in hours, must be corrected for internatinal use and DST
int show_mgdl = 0; // 0 = display mg/DL, 1 = diplay mmol/L
int default_page = 0;
char restart_at_time[10];
int restart_at_logged_errors = 0; // 0 = do not restart on errors in log
int show_current_time = 0;
int show_COB_IOB = 0;
int snooze_timeout = 30; // timeout to snooze alarm in minutes
Expand All @@ -28,7 +29,7 @@ struct tConfig {
float snd_alarm_high = 20;
int snd_no_readings = 20;
int snd_warning_at_startup = 1;
int snd_alarm_at_startup = 1;
int snd_alarm_at_startup =0;
char warning_music[64];
int warning_volume = 30;
char alarm_music[64];
Expand Down
Loading

0 comments on commit 7ae320f

Please sign in to comment.