From 8cb0f91caf59b103c65d86b1a4b68d842938458b Mon Sep 17 00:00:00 2001 From: Wiktor Date: Sat, 8 Apr 2023 22:18:07 +0200 Subject: [PATCH] Attempt to fix incorrect var reading from config (#619) replace str(get_var()) with str(int(get_var())) to correct reading (eg `b'30'` -> `30`) --- .../files/opt/crankshaft/service_lightsensor.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/stage3/03-crankshaft-base/files/opt/crankshaft/service_lightsensor.py b/stage3/03-crankshaft-base/files/opt/crankshaft/service_lightsensor.py index 62cc09a3..e8591b3c 100755 --- a/stage3/03-crankshaft-base/files/opt/crankshaft/service_lightsensor.py +++ b/stage3/03-crankshaft-base/files/opt/crankshaft/service_lightsensor.py @@ -106,27 +106,27 @@ def get_LUX_TSL2591(TSL_I2C_BUS, TSL_ADDR): # Set display brightness if Luxrounded <= int(get_var('LUX_LEVEL_1')): os.system("crankshaft brightness set " + - str(get_var('DISP_BRIGHTNESS_1')) + " &") + str(int(get_var('DISP_BRIGHTNESS_1'))) + " &") step = 1 elif Luxrounded > int(get_var('LUX_LEVEL_1')) and Luxrounded < int(get_var('LUX_LEVEL_2')): os.system("crankshaft brightness set " + - str(get_var('DISP_BRIGHTNESS_2')) + " &") + str(int(get_var('DISP_BRIGHTNESS_2'))) + " &") step = 2 elif Luxrounded >= int(get_var('LUX_LEVEL_2')) and Luxrounded < int(get_var('LUX_LEVEL_3')): os.system("crankshaft brightness set " + - str(get_var('DISP_BRIGHTNESS_3')) + " &") + str(int(get_var('DISP_BRIGHTNESS_3'))) + " &") step = 3 elif Luxrounded >= int(get_var('LUX_LEVEL_3')) and Luxrounded < int(get_var('LUX_LEVEL_4')): os.system("crankshaft brightness set " + - str(get_var('DISP_BRIGHTNESS_4')) + " &") + str(int(get_var('DISP_BRIGHTNESS_4'))) + " &") step = 4 elif Luxrounded >= int(get_var('LUX_LEVEL_4')) and Luxrounded < int(get_var('LUX_LEVEL_5')): os.system("crankshaft brightness set " + - str(get_var('DISP_BRIGHTNESS_5')) + " &") + str(int(get_var('DISP_BRIGHTNESS_5'))) + " &") step = 5 elif Luxrounded >= int(get_var('LUX_LEVEL_5')): os.system("crankshaft brightness set " + - str(get_var('DISP_BRIGHTNESS_5')) + " &") + str(int(get_var('DISP_BRIGHTNESS_5'))) + " &") step = 6 if daynight_gpio == 0: