Set neopixel brightness to 1 and use neopixel_max_value instead to spare some mem
This commit is contained in:
parent
8f73b1f864
commit
5ed1b85280
@ -9,6 +9,7 @@ gps_enable = True
|
|||||||
update_interval = 5 # in seconds
|
update_interval = 5 # in seconds
|
||||||
send_json_data = True
|
send_json_data = True
|
||||||
datetime_format = "{:04}/{:02}/{:02}_{:02}:{:02}:{:02}"
|
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)
|
* GREEN => pression : mini=960hPa, maxi = 1030hPa (range 70hPa)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
rouge = int((data['BME280']['temp']['val']-10)*255/25)
|
rouge = int((data['BME280']['temp']['val']-10)*neopixel_max_value/25)
|
||||||
if rouge > 255:
|
if rouge > neopixel_max_value:
|
||||||
rouge = 255
|
rouge = neopixel_max_value
|
||||||
if rouge < 0:
|
if rouge < 0:
|
||||||
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)
|
vert = int((data['BME280']['press']['val']-960)*neopixel_max_value/70)
|
||||||
if vert > 255:
|
if vert > neopixel_max_value:
|
||||||
vert = 255
|
vert = neopixel_max_value
|
||||||
if vert < 0:
|
if vert < 0:
|
||||||
vert = 0
|
vert = 0
|
||||||
|
|
||||||
@ -169,10 +170,10 @@ if gps_enable:
|
|||||||
|
|
||||||
# Integrated Neopixel
|
# Integrated Neopixel
|
||||||
if data_to_neopixel:
|
if data_to_neopixel:
|
||||||
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)
|
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=1)
|
||||||
else:
|
else:
|
||||||
#if neopixel is disable : turn off the LED
|
#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[0] = (0,0,0)
|
||||||
pixel = None
|
pixel = None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user