@@ -151,8 +151,8 @@ def draw_home(percent, cstate, status):
151
151
152
152
def draw_batterylow (percent ):
153
153
ugfx .clear (ugfx .WHITE )
154
- ugfx .string (0 , 0 , str (percent )+ "% - BATTERY LOW, PLEASE CHARGE !" ,"Roboto_Regular12" ,ugfx .BLACK )
155
- nick = badge .nvs_get_str ("owner" , "name" , "Hacker1337 " )
154
+ ugfx .string (0 , 0 , str (percent )+ "% - Battery empty. Please charge me !" ,"Roboto_Regular12" ,ugfx .BLACK )
155
+ nick = badge .nvs_get_str ("owner" , "name" , ":( Zzzz... " )
156
156
ugfx .string (0 , 40 , nick , "PermanentMarker36" , ugfx .BLACK )
157
157
ugfx .set_lut (ugfx .LUT_FASTER )
158
158
ugfx .flush ()
@@ -169,6 +169,8 @@ def start_launcher(pushed):
169
169
# SLEEP
170
170
171
171
def badge_sleep ():
172
+ print ("Going to sleep now..." )
173
+ badge .eink_busy_wait () #Always wait for e-ink
172
174
deepsleep .start_sleeping (30000 ) #Sleep for 30 seconds
173
175
174
176
# TIMER
@@ -180,11 +182,14 @@ def splashTimer_callback(tmr):
180
182
cstate = badge .battery_charge_status ()
181
183
vbatt = badge .battery_volt_sense ()
182
184
percent = battery_percent (3800 , 4300 , vbatt )
183
- if (cstate ) or (percent > 95 ):
184
- draw_home (percent , cstate , "Press start to open launcher!" )
185
+ if (cstate ) or (percent > 95 ) or (percent < 1 ):
186
+ if (percent == 0 ):
187
+ draw_home (percent , cstate , "Huh?! You removed the battery?" )
188
+ else :
189
+ draw_home (percent , cstate , "Press start to open the launcher!" )
185
190
else :
186
191
if (percent < 10 ):
187
- draw_batterylow (percent )
192
+ draw_batterylow (percent )
188
193
ugfx .flush ()
189
194
else :
190
195
draw_home (percent , cstate , "Zzz..." )
@@ -234,6 +239,13 @@ def splash_main():
234
239
global splashTimer
235
240
setup_services ()
236
241
start_sleep_counter ()
242
+ elif (percent == 0 ):
243
+ ugfx .clear (ugfx .WHITE )
244
+ ugfx .string (0 , 0 , "Recovery mode" , "PermanentMarker22" , ugfx .BLACK )
245
+ ugfx .string (0 , 25 , "No battery. Dropping to shell..." , "Roboto_Regular12" , ugfx .BLACK )
246
+ ugfx .set_lut (ugfx .LUT_FASTER )
247
+ ugfx .flush ()
248
+
237
249
else :
238
250
draw_batterylow (percent )
239
251
badge_sleep ()
0 commit comments