Fix some warnings, add screen_update IDLE to quit
[metawatch.git] / mw_main.c
index 566b8fb..d391048 100644 (file)
--- a/mw_main.c
+++ b/mw_main.c
@@ -257,8 +257,8 @@ int days(int m1, int y1)
 void draw_idle_calendar(mwdevice_t *mwdevice)
 {
        long unsigned int t;
-       unsigned int y,y1,m,m1,d,da,i,j,k;
-       const char a[12][20]={"January","February","March","April","May","June","July","August","September","October","November","December"};
+       unsigned int y,y1,m,m1,d,i,j,k;
+       /* const char a[12][20]={"January","February","March","April","May","June","July","August","September","October","November","December"}; */
        const char dnames[7][3] = { "Mo", "Di", "Mi", "Do", "Fr", "Sa", "So" };
        mw_buffer *mwbuf;
        unsigned char *bbuf;
@@ -429,7 +429,7 @@ void test_oled(mwdevice_t *mwdevice, unsigned char oled)
 {
        mw_buffer *mwbuf;
        unsigned char *bbuf;
-       int len, i;
+       int len;
 
        mwbuf = mw_alloc_pbuffer(80, 16, 1);
        mw_buf_clear(mwbuf, MW_BLACK);
@@ -483,6 +483,8 @@ void process_cmd(char *cmdline, int clinep, mwdata_t *mwdata)
        if (strncmp(cmdline, "quit", 4) == 0) {
                //close(mw_fd);
                //exit(0);
+               /* just in case we quit and show another screen */
+               mw_update_display(&mwdata->mwdevice, MW_SCREEN_MODE_IDLE, 0);
                g_main_loop_quit (mwdata->mloop);
        }
        if (strncmp(cmdline, "help", 4) == 0) {
@@ -498,7 +500,7 @@ void process_cmd(char *cmdline, int clinep, mwdata_t *mwdata)
        }
        if (strncmp(cmdline, "srtc", 4) == 0) {
                fprintf(stderr, "Setting RTC from system time...");
-               mw_set_rtc(&mwdata->mwdevice, MW_RTC_CLOCK_24HR, MW_RTC_DATE_DDMM);
+               mw_set_rtc(&mwdata->mwdevice);
                fprintf(stderr, "OK\n");
        }
        if (strncmp(cmdline, "grtc", 4) == 0) {
@@ -583,8 +585,7 @@ void process_cmd(char *cmdline, int clinep, mwdata_t *mwdata)
        }
        if (strncmp(cmdline, "g24", 3) == 0) {
                mdata[0] = 0;
-               mdata[1] = 0;
-               mw_nval_operation(&mwdata->mwdevice, MW_NVAL_OPERATION_READ, MW_NVAL_TIME_FORMAT, 2, mdata);
+               mw_nval_operation(&mwdata->mwdevice, MW_NVAL_OPERATION_READ, MW_NVAL_TIME_FORMAT, 1, mdata);
        }
 }