Thank You for your continued support and contributions!
require("actions") -- Contains rb.actions & rb.contextslocal batteryif (not rb.battery_level) or (not rb.audio_stop) then rb.splash(1000, "missing functions") os.exit()endif rb.backlight_force_on then rb.backlight_force_on() endwhile rb.get_plugin_action(0) ~= rb.actions.PLA_CANCEL do local battery = rb.battery_level() rb.splash(1000, battery .. "%") if battery < 45 then rb.audio_stop() rb.lcd_clear_display() rb.lcd_update() os.exit() endend
Never heard of this before. Do you have a reference for this claim?
local batteryoff = 45 --percentage of battery when script will quitrequire("actions") -- Contains rb.actions & rb.contextsif not pcall(require, "settings") then -- check if settings.lua is available otherwise put in dummy tables rb.system = rb.system or {} rb.system.global_settings = rb.system.global_settings or {}endif (not rb.battery_level) or (not rb.audio_stop) then rb.splash(1000, "missing functions") os.exit()endlocal batterylevel = rb.battery_level()local charging = falselocal poweroff = rb.system.global_settings.poweroff or {}if batterylevel < batteryoff then rb.splash(1000, "battery needs charged " .. batterylevel .. "% < " .. batteryoff .. "%") if rb.charging_state then charging = rb.charging_state() end -- exit if not already charging if not charging then os.exit() endendfunction check_battery() local dots = "" if rb.backlight_force_on then rb.backlight_force_on() end repeat rb.lcd_clear_display() rb.lcd_update() if rb.charging_state then charging = rb.charging_state() end batterylevel = rb.battery_level() if charging then rb.splash(1, "charging " .. batterylevel .. "%" .. dots) dots = dots .. "." if string.len(dots) > 4 then dots = "" end else rb.splash(1, batterylevel .. "% > " .. batteryoff .. "%") end if batterylevel < batteryoff and (not charging) then rb.audio_stop() rb.lcd_clear_display() rb.lcd_update() if rb.global_settings then -- set poweroff time to 1 minute rb.global_settings(poweroff[1], poweroff[2], 1) end return end until rb.get_plugin_action(500) == rb.actions.PLA_CANCELendcheck_battery()os.exit()
local batteryoff = 45 --percentage of battery when script will quit--require("actions") -- Contains rb.actions & rb.contextsif not pcall(require, "settings") then -- check if settings.lua is available otherwise put in dummy tables rb.system = rb.system or {} rb.system.global_settings = rb.system.global_settings or {}endif (not rb.battery_level) or (not rb.audio_stop) then rb.splash(1000, "missing functions") os.exit()endlocal batterylevel = rb.battery_level()local charging = falselocal poweroff = rb.system.global_settings.poweroff or {}if batterylevel < batteryoff then rb.splash(1000, "battery needs charged " .. batterylevel .. "% < " .. batteryoff .. "%") if rb.charging_state then charging = rb.charging_state() end -- exit if not already charging if not charging then os.exit() endendfunction check_battery() local dots = "" if rb.backlight_force_on then rb.backlight_force_on() end repeat rb.lcd_clear_display() rb.lcd_update() if rb.charging_state then charging = rb.charging_state() end batterylevel = rb.battery_level() if charging then rb.splash(1, "charging " .. batterylevel .. "%" .. dots) dots = dots .. "." if string.len(dots) > 4 then dots = "" end else rb.splash(1, batterylevel .. "% > " .. batteryoff .. "%") rb.reset_poweroff_timer() end if batterylevel < batteryoff and (not charging) then rb.audio_stop() rb.lcd_clear_display() rb.lcd_update() if rb.global_settings then -- set poweroff time to 1 minute rb.global_settings(poweroff[1], poweroff[2], 1) end return end until rb.get_plugin_action(500) > 0endcheck_battery()os.exit()
it is set up to work with either.. if you don't use the global settings patch you just need to make sure idle poweroff is set
Page created in 0.076 seconds with 21 queries.