X-Git-Url: https://git.karo-electronics.de/?p=oswald.git;a=blobdiff_plain;f=ui%2Foswald_main.c;h=f2e4abeeecd4a708a25af77d1d33abd06e77e7ba;hp=02396d4bddab2205c9077dd4cb3097eabacb0fa1;hb=ad140c1dc1090e2a99ff7a362713436e0ae51c7d;hpb=b83e605bc8ba69950a84b6ed268f0c196f68762c diff --git a/ui/oswald_main.c b/ui/oswald_main.c index 02396d4..f2e4abe 100644 --- a/ui/oswald_main.c +++ b/ui/oswald_main.c @@ -161,8 +161,9 @@ void oswald_handle_comm_input(uint16_t mlen, const void *mdat) if (icmd[0] == '$') { if (strncmp(icmd, "$GRT", 4) == 0) { // get current RTC char rtime[16]; - snprintf(rtime, 10, "%02d%02d%02d\n", OswaldClk.hour, OswaldClk.minute, OswaldClk.second); + snprintf(rtime, 16, "#RTC%02d%02d%02d\n", OswaldClk.hour, OswaldClk.minute, OswaldClk.second); hal_bluetooth_send_data(rtime, strlen(rtime)); + } else if (strncmp(icmd, "$SRT", 4) == 0) { // set current RTC } else if (strncmp(icmd, "$MSG", 4) == 0) { // message on main screen char *msg = (icmd+4); mlen -= 4; @@ -170,6 +171,10 @@ void oswald_handle_comm_input(uint16_t mlen, const void *mdat) strncpy(MainMessage, msg, (mlen > 147) ? 147 : mlen); } else if (strncmp(icmd, "$MCL", 4) == 0) { // clear message memset(MainMessage, 0, 148); + } else if (strncmp(icmd, "$BAT", 4) == 0) { // clear message + char rtime[16]; + snprintf(rtime, 16, "#BAT%d,%d\n", OswaldPowerState.charge_state, OswaldPowerState.percent); + hal_bluetooth_send_data(rtime, strlen(rtime)); } } }