Latest scripts and such from argon40.
These scripts are used by me to determine if there is anything else I want to add to the oneUp environment.
This commit is contained in:
@@ -131,7 +131,7 @@ def battery_checkupdateprofile():
|
||||
try:
|
||||
REG_GPIOCONFIG = 0x0A
|
||||
|
||||
PROFILE_DATALIST = [0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA8,0xAA,0xBE,0xC6,0xB8,0xAE,0xC2,0x98,0x82,0xFF,0xFF,0xCA,0x98,0x75,0x63,0x55,0x4E,0x4C,0x49,0x98,0x88,0xDC,0x34,0xDB,0xD3,0xD4,0xD3,0xD0,0xCE,0xCB,0xBB,0xE7,0xA2,0xC2,0xC4,0xAE,0x96,0x89,0x80,0x74,0x67,0x63,0x71,0x8E,0x9F,0x85,0x6F,0x3B,0x20,0x00,0xAB,0x10,0x00,0xB0,0x73,0x00,0x00,0x00,0x64,0x08,0xD3,0x77,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xAC]
|
||||
PROFILE_DATALIST = [0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA8,0xAA,0xBE,0xC6,0xB8,0xAE,0xC2,0x98,0x82,0xFF,0xFF,0xCA,0x98,0x75,0x63,0x55,0x4E,0x4C,0x49,0x98,0x88,0xDC,0x34,0xDB,0xD3,0xD4,0xD3,0xD0,0xCE,0xCB,0xBB,0xE7,0xA2,0xC2,0xC4,0xAE,0x96,0x89,0x80,0x74,0x67,0x63,0x71,0x8E,0x9F,0x85,0x6F,0x3B,0x20,0x00,0xAB,0x10,0xFF,0xB0,0x73,0x00,0x00,0x00,0x64,0x08,0xD3,0x77,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFA]
|
||||
|
||||
PROFILE_LEN = len(PROFILE_DATALIST)
|
||||
|
||||
@@ -351,10 +351,17 @@ def battery_check(readq):
|
||||
curnotifycritical = False
|
||||
|
||||
if device_charging == 0:
|
||||
if device_battery>99:
|
||||
statusstr = "Charged"
|
||||
else:
|
||||
statusstr = "Charging"
|
||||
if "Shutting Down" in prevnotifymsg:
|
||||
os.system("shutdown -c ""Charging, shutdown cancelled.""")
|
||||
debuglog("battery-shutdown", "Abort")
|
||||
|
||||
if device_battery>99:
|
||||
# Prevents switching issue
|
||||
statusstr = "Charged"
|
||||
curnotifymsg = statusstr
|
||||
tmpiconfile = tmpiconfile+"charge_"+str(device_battery)
|
||||
elif device_charging == 0:
|
||||
statusstr = "Charging"
|
||||
curnotifymsg = statusstr
|
||||
tmpiconfile = tmpiconfile+"charge_"+str(device_battery)
|
||||
else:
|
||||
@@ -367,8 +374,12 @@ def battery_check(readq):
|
||||
curnotifymsg="50%% Battery"
|
||||
elif device_battery > 10:
|
||||
curnotifymsg="20%% Battery"
|
||||
elif device_battery > 5:
|
||||
#curnotifymsg="Low Battery"
|
||||
curnotifymsg="Low Battery: The device may power off automatically soon."
|
||||
curnotifycritical=True
|
||||
else:
|
||||
curnotifymsg="Low Battery"
|
||||
curnotifymsg="CRITICAL BATTERY: Shutting Down in 1 minute"
|
||||
curnotifycritical=True
|
||||
|
||||
tmpiconfile = tmpiconfile + ".png"
|
||||
@@ -382,7 +393,9 @@ def battery_check(readq):
|
||||
# Send notification if necessary
|
||||
if prevnotifymsg != curnotifymsg:
|
||||
notifymessage(curnotifymsg, curnotifycritical)
|
||||
|
||||
if device_battery <= 5 and device_charging != 0:
|
||||
os.system("shutdown +1 """+curnotifymsg+".""")
|
||||
debuglog("battery-shutdown", "Shutdown in 1 minute")
|
||||
prevnotifymsg = curnotifymsg
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user