diff --git a/circuitpython/main.py b/circuitpython/main.py index 649ac10..474fa57 100644 --- a/circuitpython/main.py +++ b/circuitpython/main.py @@ -9,6 +9,7 @@ gps_enable = True update_interval = 5 # in seconds send_json_data = True datetime_format = "{:04}/{:02}/{:02}_{:02}:{:02}:{:02}" +neopixel_max_value =const(100) #max value instead of brightness to spare some mem ####################### @@ -119,17 +120,17 @@ def update_neopixel(data): * GREEN => pression : mini=960hPa, maxi = 1030hPa (range 70hPa) """ - rouge = int((data['BME280']['temp']['val']-10)*255/25) - if rouge > 255: - rouge = 255 + rouge = int((data['BME280']['temp']['val']-10)*neopixel_max_value/25) + if rouge > neopixel_max_value: + rouge = neopixel_max_value if rouge < 0: rouge = 0 - bleu = int(data['BME280']['hum']['val']*255/100) + bleu = int(data['BME280']['hum']['val']*neopixel_max_value/100) - vert = int((data['BME280']['press']['val']-960)*255/70) - if vert > 255: - vert = 255 + vert = int((data['BME280']['press']['val']-960)*neopixel_max_value/70) + if vert > neopixel_max_value: + vert = neopixel_max_value if vert < 0: vert = 0 @@ -169,10 +170,10 @@ if gps_enable: # Integrated Neopixel if data_to_neopixel: - pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) + pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=1) else: #if neopixel is disable : turn off the LED - pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) + pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=1) pixel[0] = (0,0,0) pixel = None