Terminal program for MailStation devices
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

main: If modem MSR changes, update F1

+10 -6
+10 -6
main.c
··· 23 23 #include "mailstation.h" 24 24 #include "logo.h" 25 25 26 - unsigned char lastkey; 26 + unsigned char last_key; 27 27 unsigned char esc; 28 28 unsigned char old_minutes; 29 29 unsigned char obuf_sent_pos; 30 + unsigned char last_modem_msr; 30 31 31 32 #define MODEM_MSR_DCD (1 << 7) 32 33 ··· 73 74 int b, j; 74 75 75 76 /* ignore first peekkey() if it returns power button */ 76 - lastkey = KEY_POWER; 77 + last_key = KEY_POWER; 77 78 esc = 0; 78 79 source = SOURCE_WIFI; 79 80 putchar_sgr = 0; ··· 152 153 153 154 switch (source) { 154 155 case SOURCE_MODEM: 155 - modem_msr(); 156 + if (modem_msr() != last_modem_msr) { 157 + update_f1(); 158 + last_modem_msr = modem_curmsr; 159 + } 156 160 if (modem_lsr() & (1 << 0)) { 157 161 process_input(modem_read()); 158 162 continue; ··· 255 259 256 260 /* this breaks key-repeat, but it's needed to debounce */ 257 261 if (b == 0) 258 - lastkey = 0; 259 - else if (b == lastkey) 262 + last_key = 0; 263 + else if (b == last_key) 260 264 b = 0; 261 265 else 262 - lastkey = b; 266 + last_key = b; 263 267 264 268 if (b == 0) 265 269 return 0;