Skip to content

Commit

Permalink
BG/calibration/unknown entries are now filtered.
Browse files Browse the repository at this point in the history
Missed reading (long time no data) sound allert added.
Added possibility to change warning and alarm sound volume in INI.
Reorganized display and added possibility to display COB and IOB.
Added possibility to display current clock instead of the last sensor read time.
Binary files for direct upload by M5Burner added.
  • Loading branch information
Martin8bity committed May 12, 2019
1 parent 16bb92a commit e067464
Show file tree
Hide file tree
Showing 8 changed files with 430 additions and 9,711 deletions.
Binary file added Binaries/M5_NightscoutMon.ino.bin
Binary file not shown.
Binary file added Binaries/M5_NightscoutMon.ino.partitions.bin
Binary file not shown.
96 changes: 95 additions & 1 deletion M5NSconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void readConfiguration(char *iniFilename, tConfig *cfg) {
else {
Serial.print("Could not read 'nightscout' from section 'config', error was ");
printErrorMessage(ini.getError());
M5.Lcd.println("No URL in INI file");
M5.Lcd.println("No Nightscout URL in INI file");
while (1)
;
}
Expand Down Expand Up @@ -132,6 +132,26 @@ void readConfiguration(char *iniFilename, tConfig *cfg) {
cfg->show_mgdl = 0;
}

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

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

if (ini.getValue("config", "snooze_timeout", buffer, bufferLen)) {
Serial.print("snooze_timeout = ");
cfg->snooze_timeout = atoi(buffer);
Expand Down Expand Up @@ -234,6 +254,80 @@ void readConfiguration(char *iniFilename, tConfig *cfg) {
cfg->snd_alarm = 3.0;
}

if (ini.getValue("config", "snd_warning_high", buffer, bufferLen)) {
Serial.print("snd_warning_high = ");
cfg->snd_warning_high = atof(buffer);
if( cfg->show_mgdl )
cfg->snd_warning_high /= 18.0;
Serial.println(cfg->snd_warning_high);
}
else {
Serial.println("NO snd_warning_high defined");
cfg->snd_warning_high = 14.0;
}

if (ini.getValue("config", "snd_alarm_high", buffer, bufferLen)) {
Serial.print("snd_alarm_high = ");
cfg->snd_alarm_high = atof(buffer);
if( cfg->show_mgdl )
cfg->snd_alarm_high /= 18.0;
Serial.println(cfg->snd_alarm_high);
}
else {
Serial.println("NO snd_alarm_high defined");
cfg->snd_alarm_high = 20.0;
}

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

if (ini.getValue("config", "warning_music", buffer, bufferLen)) {
Serial.print("warning_music = ");
Serial.println(buffer);
strlcpy(cfg->warning_music, buffer, 64);
}
else {
Serial.println("NO warning_music");
cfg->warning_music[0]=0;
}

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

if (ini.getValue("config", "alarm_music", buffer, bufferLen)) {
Serial.print("alarm_music = ");
Serial.println(buffer);
strlcpy(cfg->alarm_music, buffer, 64);
}
else {
Serial.println("NO alarm_music");
cfg->alarm_music[0]=0;
}

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

if (ini.getValue("config", "brightness1", buffer, bufferLen)) {
Serial.print("brightness1 = ");
Serial.println(buffer);
Expand Down
11 changes: 10 additions & 1 deletion M5NSconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,25 @@ struct tConfig {
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 show_current_time = 0;
int show_COB_IOB = 0;
int snooze_timeout = 30; // timeout to snooze alarm in minutes
int alarm_repeat = 5; // repeat alarm every X minutes
int dev_mode = 0; // developer mode, do not use, does strange things and changes often ;-)
float yellow_low = 4.5;
float yellow_high = 9;
float red_low = 3.9;
float red_high = 11;
float snd_warning = 3.7;
float snd_alarm = 3.0;
float snd_warning_high = 14;
float snd_alarm_high = 20;
int snd_no_readings = 20;
char warning_music[64];
int warning_volume = 30;
char alarm_music[64];
int alarm_volume = 100;
uint8_t brightness1, brightness2, brightness3;
int dev_mode = 0; // developer mode, do not use, does strange things and changes often ;-)
char wlan1ssid[32];
char wlan1pass[32];
char wlan2ssid[32];
Expand Down
Loading

0 comments on commit e067464

Please sign in to comment.