Lot's of stuff...
authorNils Faerber <nils.faerber@kernelconcepts.de>
Sat, 27 Apr 2013 20:19:55 +0000 (22:19 +0200)
committerNils Faerber <nils.faerber@kernelconcepts.de>
Sat, 27 Apr 2013 20:19:55 +0000 (22:19 +0200)
27 files changed:
README
metawatch [new submodule]
ui/LcdDisplay.c
ui/LcdDisplay.h
ui/Oswald.xbm [deleted file]
ui/bitmaps/Bluetooth_icon.xbm [moved from ui/Bluetooth_icon.xbm with 100% similarity]
ui/bitmaps/alarm_icon.xbm [moved from ui/alarm_icon.xbm with 100% similarity]
ui/bitmaps/battery0_icon.xbm [moved from ui/battery0_icon.xbm with 100% similarity]
ui/bitmaps/battery100_icon.xbm [moved from ui/battery100_icon.xbm with 100% similarity]
ui/bitmaps/battery25_icon.xbm [moved from ui/battery25_icon.xbm with 100% similarity]
ui/bitmaps/battery50_icon.xbm [moved from ui/battery50_icon.xbm with 100% similarity]
ui/bitmaps/battery75_icon.xbm [moved from ui/battery75_icon.xbm with 100% similarity]
ui/bitmaps/bluetooth_con_icon.xbm [new file with mode: 0644]
ui/bitmaps/bluetooth_icon.xbm [moved from ui/bluetooth_icon.xbm with 100% similarity]
ui/bitmaps/charger_icon.xbm [moved from ui/charger_icon.xbm with 100% similarity]
ui/bitmaps/downbutton_icon.xbm [moved from ui/downbutton_icon.xbm with 100% similarity]
ui/bitmaps/lapsebutton_icon.xbm [moved from ui/lapsebutton_icon.xbm with 100% similarity]
ui/bitmaps/resetbutton_icon.xbm [moved from ui/resetbutton_icon.xbm with 100% similarity]
ui/bitmaps/startstopbutton_icon.xbm [moved from ui/startstopbutton_icon.xbm with 100% similarity]
ui/bitmaps/stopwatch.xbm [moved from ui/stopwatch.xbm with 100% similarity]
ui/bitmaps/stopwatch_icon.xbm [moved from ui/stopwatch_icon.xbm with 100% similarity]
ui/bitmaps/timesetup_icon.xbm [moved from ui/timesetup_icon.xbm with 100% similarity]
ui/bitmaps/upbutton_icon.xbm [moved from ui/upbutton_icon.xbm with 100% similarity]
ui/bitmaps/watch_icon.xbm [moved from ui/watch_icon.xbm with 100% similarity]
ui/oswald_hal.h
ui/oswald_main.c
ui/oswald_watch_faces.c

diff --git a/README b/README
index 51a6c5c..89390b3 100644 (file)
--- a/README
+++ b/README
@@ -1,3 +1,7 @@
 OSWALD
 
 Open Smart Watch Application Loadable Development
+
+License: LGPL (Gnu Library Public License),
+permission granted for static linking,
+see individual files for licensing information
diff --git a/metawatch b/metawatch
new file mode 160000 (submodule)
index 0000000..cc2b5c0
--- /dev/null
+++ b/metawatch
@@ -0,0 +1 @@
+Subproject commit cc2b5c03be2b68fafd5b9022ab5a7bb70d5e7e7c
index 725908a..f4e26c9 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "LcdDisplay.h"
 
+
 void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_t width, const uint8_t height, const void *bmp)
 {
        uint8_t x, y;
@@ -20,7 +21,7 @@ void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_
        }
 }
 
-void DrawLcdLineBresenham(u8t xstart, u8t ystart, u8t xend, u8t yend)
+void DrawLcdLineBresenham(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend)
 {
        int x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
  
@@ -65,7 +66,7 @@ void DrawLcdLineBresenham(u8t xstart, u8t ystart, u8t xend, u8t yend)
        // lcd_update_display();
 }
 
-void DrawLcdLineBresenhamWW(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickness)
+void DrawLcdLineBresenhamWW(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend, const uint8_t thickness)
 {
        int i, x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
  
@@ -122,7 +123,7 @@ void DrawLcdLineBresenhamWW(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thic
        // lcd_update_display();
 }
 
-u8t WriteLcdCharacter(u8t x, u8t y, u8t Character)
+u8t WriteLcdCharacter(const uint8_t x, const uint8_t y, const uint8_t Character)
 {
        u8t CharacterHeight = GetCharacterHeight();
        u8t CharacterWidth = GetCharacterWidth(Character);
@@ -137,10 +138,10 @@ u8t WriteLcdCharacter(u8t x, u8t y, u8t Character)
                        if (bitmap[ly] & (1<<lx)) {
                                hal_lcd_set_pixel(lx+x, ly+y, TRUE);
                                // printf(".");
-                       } else {
+                       } /*else {
                                hal_lcd_set_pixel(lx+x, ly+y, FALSE);
                                // printf(" ");
-                       }
+                       }*/
                }
                // printf("\n");
        }
@@ -148,11 +149,11 @@ u8t WriteLcdCharacter(u8t x, u8t y, u8t Character)
        return CharacterWidth + GetFontSpacing();
 }
 
-u8t WriteLcdString(u8t x, u8t y, char *str)
+u8t WriteLcdString(const uint8_t x, const uint8_t y, const char *str)
 {
        int lx, i, strl;
 
-       strl = oswald_strlen(str);
+       strl = oswald_strlen((char *)str);
        if (strl == 0)
                return 0;
 
@@ -164,7 +165,7 @@ u8t WriteLcdString(u8t x, u8t y, char *str)
 }
 
 
-void WriteLcdNumber(u8t x, u8t y, s16t number)
+void WriteLcdNumber(const uint8_t x, const uint8_t y, const int16_t number)
 {
        int lx, i, strl;
        char str[8];
index 42152f0..5f31f42 100644 (file)
@@ -4,11 +4,11 @@
 // #include "oswald_hal.h"
 
 void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_t width, const uint8_t height, const void *bmp);
-void DrawLcdLineBresenham(u8t xstart, u8t ystart, u8t xend, u8t yend);
-void DrawLcdLineBresenhamWW(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickness);
-u8t WriteLcdCharacter(u8t x, u8t y, u8t Character);
-u8t WriteLcdString(u8t x, u8t y, char *str);
-void WriteLcdNumber(u8t x, u8t y, s16t number);
+void DrawLcdLineBresenham(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend);
+void DrawLcdLineBresenhamWW(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend, const uint8_t thickness);
+u8t WriteLcdCharacter(const uint8_t x, const uint8_t y, const uint8_t Character);
+u8t WriteLcdString(const uint8_t x, const uint8_t y, const char *str);
+void WriteLcdNumber(const uint8_t x, const uint8_t y, const int16_t number);
 
 #endif
 
diff --git a/ui/Oswald.xbm b/ui/Oswald.xbm
deleted file mode 100644 (file)
index 4119f6c..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-#define Oswald_width 80
-#define Oswald_height 96
-static const char Oswald_bits[] = {
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x0F, 
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x00, 0x00, 0x00, 0x00, 
-  0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-  0x00, 0x00, 0xF8, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-  0xF0, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 
-  0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x0F, 0x00, 
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 
-  0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 
-  0x00, 0x00, 0x00, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-  0x00, 0xFE, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xBA, 0x01, 0x00, 0x00, 0xF8, 
-  0x3F, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x3F, 0x00, 0x00, 0xF0, 0x7F, 0x00, 
-  0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x00, 0x00, 0xE0, 0x7F, 0x00, 0x00, 0x00, 
-  0xF0, 0xFF, 0xFF, 0x03, 0x00, 0xE0, 0x7F, 0x00, 0x00, 0x00, 0xF8, 0xFF, 
-  0xFF, 0x0F, 0x00, 0xC0, 0x7F, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x3F, 
-  0x00, 0xC0, 0x7F, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x7F, 0x00, 0xC0, 
-  0x7F, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0x00, 0x80, 0x7F, 0x00, 
-  0x00, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0x03, 0x80, 0x3F, 0x00, 0x00, 0x00, 
-  0xE0, 0xFF, 0xFF, 0xFF, 0x07, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x59, 
-  0xE9, 0xFF, 0x0F, 0xC0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 
-  0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 
-  0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0, 0x83, 0x0F, 0x00, 
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xC0, 0x01, 0x0F, 0x00, 0x00, 0x00, 
-  0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 
-  0x00, 0x0C, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 
-  0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 
-  0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x18, 0x00, 
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x10, 0x18, 0x00, 0x00, 0x00, 
-  0x00, 0x00, 0x00, 0x83, 0x07, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 
-  0x00, 0x83, 0x07, 0x78, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x81, 
-  0x0F, 0x7C, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x83, 0x07, 0x7C, 
-  0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC3, 0x07, 0x7C, 0x38, 0x00, 
-  0x00, 0x00, 0x00, 0x00, 0x80, 0x83, 0x07, 0x7C, 0x38, 0x00, 0x00, 0x00, 
-  0x00, 0x00, 0x80, 0x87, 0x07, 0x7C, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 
-  0x80, 0xCF, 0x07, 0x7C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCF, 
-  0x87, 0x7C, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xF0, 0x03, 
-  0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0xF8, 0x03, 0x16, 0x00, 
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xF8, 0x03, 0x13, 0x00, 0x00, 0x00, 
-  0x00, 0x00, 0x00, 0x1A, 0xF0, 0x81, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 
-  0x00, 0x34, 0x00, 0xC0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC8, 
-  0x01, 0x38, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xF7, 0xCF, 
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x58, 0xFC, 0x1E, 0x00, 
-  0x00, 0x00, 0x00, 0x00, 0xE0, 0x9F, 0xFF, 0x67, 0xFE, 0x00, 0x00, 0x00, 
-  0x00, 0x00, 0xF8, 0xBF, 0xF0, 0x63, 0xFE, 0x07, 0x00, 0x00, 0x00, 0x00, 
-  0xFC, 0xFF, 0xE6, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xDF, 0xFF, 
-  0xDF, 0xA2, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x80, 0xE1, 0xEF, 0x00, 0xF1, 
-  0xB6, 0x63, 0x00, 0x00, 0x00, 0x40, 0x00, 0x74, 0x00, 0xF0, 0x13, 0x80, 
-  0x00, 0x00, 0x00, 0x70, 0x00, 0x96, 0x00, 0x9C, 0x21, 0x00, 0x01, 0x00, 
-  0x00, 0x48, 0xC0, 0x89, 0x03, 0x27, 0xC1, 0x00, 0x01, 0x00, 0x00, 0x64, 
-  0xD1, 0xC8, 0xFE, 0x66, 0x82, 0x11, 0x01, 0x00, 0x00, 0x3C, 0x33, 0x44, 
-  0x06, 0x3C, 0x02, 0x91, 0x03, 0x00, 0x00, 0x10, 0x11, 0x84, 0x03, 0x00, 
-  0x02, 0xB3, 0x04, 0x00, 0x00, 0xE0, 0x09, 0x04, 0x01, 0x00, 0x02, 0xB1, 
-  0x04, 0x00, 0x00, 0x00, 0x07, 0x04, 0x00, 0x00, 0x02, 0x91, 0x05, 0x00, 
-  0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x07, 0x9E, 0x07, 0x00, 0x00, 0x00, 
-  0x00, 0x0C, 0x00, 0x00, 0x04, 0xE0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 
-  0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x80, 
-  0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0xA4, 0xC7, 0x07, 0x00, 
-  0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x78, 0xF9, 0x0F, 0x00, 0x00, 0x00, 
-  0x00, 0x00, 0x00, 0xFE, 0x0F, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 
-  0x00, 0xFF, 0x00, 0xF0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 
-  0x00, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xE0, 
-  0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xE0, 0x1F, 0x00, 
-  0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x00, 0xF0, 0x1F, 0x00, 0x00, 0x00, 
-  0x00, 0x00, 0x00, 0xFF, 0x01, 0xFC, 0x2F, 0x10, 0x00, 0x00, 0x00, 0x00, 
-  0x80, 0xFF, 0x05, 0xF2, 0xF3, 0xFF, 0x01, 0x00, 0x00, 0x00, 0xD4, 0xFC, 
-  0x04, 0x02, 0x3C, 0x00, 0x03, 0x00, 0x00, 0x80, 0xEF, 0x01, 0x0C, 0x8E, 
-  0x07, 0x00, 0x02, 0x00, 0x00, 0xC0, 0x00, 0x07, 0x1E, 0xF9, 0x03, 0x00, 
-  0x04, 0x00, 0x00, 0x20, 0x00, 0xFC, 0xB1, 0x81, 0x00, 0x00, 0x06, 0x00, 
-  0x00, 0x10, 0x00, 0x30, 0xE0, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x10, 
-  0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x10, 0x00, 0x00, 
-  0xE0, 0x3C, 0x00, 0x80, 0x05, 0x00, 0x00, 0x38, 0x00, 0x00, 0xF8, 0x83, 
-  0x07, 0xE0, 0x02, 0x00, 0x00, 0x78, 0x00, 0x00, 0x6F, 0x7E, 0xFE, 0x3E, 
-  0x03, 0x00, 0x00, 0xD0, 0x01, 0x30, 0x30, 0xC0, 0x81, 0xC3, 0x01, 0x00, 
-  0x00, 0x20, 0xFF, 0x4F, 0x0F, 0x00, 0x0E, 0x78, 0x00, 0x00, 0x00, 0xC0, 
-  0x09, 0xFA, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x07, 
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-  };
similarity index 100%
rename from ui/alarm_icon.xbm
rename to ui/bitmaps/alarm_icon.xbm
diff --git a/ui/bitmaps/bluetooth_con_icon.xbm b/ui/bitmaps/bluetooth_con_icon.xbm
new file mode 100644 (file)
index 0000000..468f55e
--- /dev/null
@@ -0,0 +1,7 @@
+#define bluetooth_con_icon_width 15
+#define bluetooth_con_icon_height 20
+static unsigned char bluetooth_con_icon_bits[] = {
+  0x6c, 0x00, 0xce, 0x00, 0xaa, 0x00, 0xc6, 0x00, 0xaa, 0x00, 0xce, 0x00,
+  0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, };
similarity index 100%
rename from ui/stopwatch.xbm
rename to ui/bitmaps/stopwatch.xbm
similarity index 100%
rename from ui/watch_icon.xbm
rename to ui/bitmaps/watch_icon.xbm
index ab1e7c0..f0ab7a4 100644 (file)
@@ -5,7 +5,7 @@
  * these functions must be implemented for a concrete hardware
  */
 
-void hal_lcd_set_pixel(unsigned int x, unsigned int y, unsigned char state);
+void hal_lcd_set_pixel(uint8_t x, uint8_t y, uint8_t color);
 void hal_lcd_clear_display(void);
 void hal_lcd_update_display(void);
 /* sets the backlight on/off, on=TRUE, off=FALSE */
index 02396d4..f2e4abe 100644 (file)
@@ -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));
                }
        }
 }
index 7e27fd4..4ca034f 100644 (file)
@@ -16,6 +16,7 @@
 #include "battery100_icon.xbm"
 #include "charger_icon.xbm"
 #include "bluetooth_icon.xbm"
+#include "bluetooth_con_icon.xbm"
 
 
 /* sine table, per degree, factor 100 */
@@ -71,6 +72,43 @@ int16_t f_cos(int16_t v)
        return sintab[v];
 }
 
+void draw_status_icons(void)
+{
+       static uint8_t ci = 0;
+       
+       if (OswaldPowerState.source) {
+               oswald_draw_bitmap(81, 0, charger_icon_width, charger_icon_height, charger_icon_bits);
+
+               if (OswaldPowerState.charge_state != POWER_CHARGER_DONE) {
+                       if (ci==0) oswald_draw_bitmap(81, 0, battery0_icon_width, battery0_icon_height, battery0_icon_bits);
+                       else if (ci==1) oswald_draw_bitmap(81, 0, battery25_icon_width, battery25_icon_height, battery25_icon_bits);
+                       else if (ci==2) oswald_draw_bitmap(81, 0, battery50_icon_width, battery50_icon_height, battery50_icon_bits);
+                       else if (ci==3) oswald_draw_bitmap(81, 0, battery75_icon_width, battery75_icon_height, battery75_icon_bits);
+                       else if (ci==4) oswald_draw_bitmap(81, 0, battery100_icon_width, battery100_icon_height, battery100_icon_bits);
+                       ci++;
+                       ci %= 5;
+               } else {
+                       oswald_draw_bitmap(81, 0, battery100_icon_width, battery100_icon_height, battery100_icon_bits);
+               }
+       } else {
+               if (OswaldPowerState.percent > 75)
+                       oswald_draw_bitmap(81, 0, battery100_icon_width, battery100_icon_height, battery100_icon_bits);
+               else if (OswaldPowerState.percent > 50)
+                       oswald_draw_bitmap(81, 0, battery75_icon_width, battery75_icon_height, battery75_icon_bits);
+               else if (OswaldPowerState.percent > 25)
+                       oswald_draw_bitmap(81, 0, battery50_icon_width, battery50_icon_height, battery50_icon_bits);
+               else if (OswaldPowerState.percent > 5)
+                       oswald_draw_bitmap(81, 0, battery25_icon_width, battery25_icon_height, battery25_icon_bits);
+               else
+                       oswald_draw_bitmap(81, 0, battery0_icon_width, battery0_icon_height, battery0_icon_bits);
+       }
+
+       if (hal_bluetooth_get_state() == BLUETOOTH_ON)
+               oswald_draw_bitmap(81, 0, bluetooth_icon_width, bluetooth_icon_height, bluetooth_icon_bits);
+       else if (hal_bluetooth_get_state() == BLUETOOTH_CONNECTED)
+               oswald_draw_bitmap(81, 0, bluetooth_con_icon_width, bluetooth_con_icon_height, bluetooth_con_icon_bits);
+}
+
 void DrawLcdAnaClock(boolean show_seconds)
 {
        int16_t i, x, y, x2, y2;
@@ -99,40 +137,42 @@ void DrawLcdAnaClock(boolean show_seconds)
        snprintf(tstr, 16, "%02d", OswaldClk.day);
        WriteLcdString(70, 40, tstr);
 
+       // Marker
        // plot(R*cos(360° * i/N), R*sin(360° * i/N))
        for (i=0; i<12; i++) {
-               tmp = 48 + ((43 * f_cos((360 / 12) * i)) / 100);
-               x =  tmp;
-               tmp = 48 + ((43 * f_sin((360 / 12) * i)) / 100);
-               y =  tmp;
-               tmp = 48 + ((48 * f_cos((360 / 12) * i)) / 100);
-               x2 =  tmp;
-               tmp = 48 + ((48 * f_sin((360 / 12) * i)) / 100);
-               y2 =  tmp;
+               x = 47 + ((43 * f_cos((360 / 12) * i)) / 100);
+               y = 47 + ((43 * f_sin((360 / 12) * i)) / 100);
+               x2 = 47 + ((47 * f_cos((360 / 12) * i)) / 100);
+               y2 = 47 + ((47 * f_sin((360 / 12) * i)) / 100);
                DrawLcdLineBresenhamWW(x, y, x2, y2, 2);
+               // g_printerr("br %d,%d %d,%d\n", x,y,x2,y2);
        };
 
        // Hour
-       tmp = 48 + (30 * f_cos(((360 / 12) * hour) + ((OswaldClk.minute * 360) /12 / 60)) / 100);
+       tmp = 47 + (30 * f_cos(((360 / 12) * hour) + ((OswaldClk.minute * 360) /12 / 60)) / 100);
        x =  tmp;
-       tmp = 48 + (30 * f_sin(((360 / 12) * hour) + ((OswaldClk.minute * 360) /12 / 60)) / 100);
+       tmp = 47 + (30 * f_sin(((360 / 12) * hour) + ((OswaldClk.minute * 360) /12 / 60)) / 100);
        y =  tmp;
-       DrawLcdLineBresenhamWW(48, 48, x, y, 2);
+       DrawLcdLineBresenhamWW(47, 47, x, y, 2);
+
        // Minute
-       tmp = 48 + ((40 * f_cos((360 / 60) * minute)) / 100);
+       tmp = 47 + ((40 * f_cos((360 / 60) * minute)) / 100);
        x =  tmp;
-       tmp = 48 + ((40 * f_sin((360 / 60) * minute)) / 100);
+       tmp = 47 + ((40 * f_sin((360 / 60) * minute)) / 100);
        y =  tmp;
-       DrawLcdLineBresenhamWW(48, 48, x, y, 2);
+       DrawLcdLineBresenhamWW(47, 47, x, y, 2);
+
        if (show_seconds) {
                // Seconds
-               tmp = 48 + ((40 * f_cos((360 / 60) * seconds)) / 100);
+               tmp = 47 + ((40 * f_cos((360 / 60) * seconds)) / 100);
                x =  tmp;
-               tmp = 48 + ((40 * f_sin((360 / 60) * seconds)) / 100);
+               tmp = 47 + ((40 * f_sin((360 / 60) * seconds)) / 100);
                y =  tmp;
-               DrawLcdLineBresenham(48, 48, x, y);
+               DrawLcdLineBresenham(47, 47, x, y);
        };
 
+       draw_status_icons();
+
        hal_lcd_update_display();
 }
 
@@ -186,6 +226,7 @@ void DrawLcdDigitalClock(boolean show_seconds)
                snprintf(tstr, 16, "%d/%d %d", OswaldClk.month, OswaldClk.day, OswaldClk.year);
        WriteLcdString(3, 25, tstr);
 
+#if 0
        if (OswaldPowerState.source)
                oswald_draw_bitmap(81, 4, charger_icon_width, charger_icon_height, charger_icon_bits);
 
@@ -203,6 +244,9 @@ void DrawLcdDigitalClock(boolean show_seconds)
 
        if (hal_bluetooth_get_state() >= BLUETOOTH_ON)
                oswald_draw_bitmap(81, 4, bluetooth_icon_width, bluetooth_icon_height, bluetooth_icon_bits);
+#else
+       draw_status_icons();
+#endif
 
        gRow = 0;
        gColumn = 45;