@@ -45,8 +45,10 @@ void Launcher::render_system_bar()
4545
4646 // Bat
4747 if ((GetHAL ().millis () - _data.bat_update_time_count ) > 5000 || _data.bat_update_time_count == 0 ) {
48- auto bat_level = GetHAL ().getBatLevel ();
48+ auto bat_level = GetHAL ().getBatLevel ();
49+ _data.system_state .bat_level = fmt::format (" {}" , bat_level);
4950 // mclog::tagInfo("system_bar", "get bat level: {}", bat_level);
51+ // printf("b:%d\n", bat_level);
5052
5153 if (bat_level >= 100 ) {
5254 _data.system_state .bat_state = 1 ;
@@ -94,7 +96,7 @@ void Launcher::render_system_bar()
9496 GetHAL ().canvasSystemBar .pushImage (x, y, 16 , 16 , image_data_wifi5);
9597 }
9698
97- // Bat
99+ // Bat icon
98100 x = GetHAL ().canvasSystemBar .width () - 45 ;
99101 y = 5 ;
100102
@@ -108,6 +110,12 @@ void Launcher::render_system_bar()
108110 GetHAL ().canvasSystemBar .pushImage (x, y, 32 , 16 , image_data_bat4);
109111 }
110112
113+ // Bat level
114+ GetHAL ().canvasSystemBar .setFont (&fonts::Font0);
115+ GetHAL ().canvasSystemBar .setTextColor ((uint32_t )0x000000 );
116+ GetHAL ().canvasSystemBar .drawCenterString (_data.system_state .bat_level .c_str (), 176 ,
117+ GetHAL ().canvasSystemBar .height () / 2 - 3 );
118+
111119 // Push
112120 GetHAL ().pushCanvasSystemBar ();
113121}
0 commit comments