|
@@ -116,7 +116,7 @@ class Send:
|
|
|
class Get:
|
|
|
def Power_data(pin, key, Mode="Default"):
|
|
|
GPIO.setup (pin,GPIO.OUT,initial=GPIO.HIGH)
|
|
|
- time.sleep(1)
|
|
|
+ time.sleep(3)
|
|
|
|
|
|
ina226 = INA226()
|
|
|
Voltage = ina226.busVoltage()
|
|
@@ -132,13 +132,13 @@ class Get:
|
|
|
|
|
|
if (Voltage >= 4):
|
|
|
Current = ina226.shuntCurrent()
|
|
|
- time.sleep(2)
|
|
|
+ time.sleep(3)
|
|
|
Current = ina226.shuntCurrent()
|
|
|
|
|
|
|
|
|
while (Current <= 0.05 or Current >= 1):
|
|
|
print ("[info]\t"+key+" 电流异常 " + str(Current))
|
|
|
- time.sleep(2)
|
|
|
+ time.sleep(3)
|
|
|
Current = ina226.shuntCurrent()
|
|
|
print ("[info]\t"+key+" 电流异常重试 " + str(Current))
|
|
|
ii = ii + 1
|
|
@@ -147,7 +147,7 @@ class Get:
|
|
|
break
|
|
|
return Current
|
|
|
else:
|
|
|
- print ("[Error]电流获取错误")
|
|
|
+ print ("[Error]电压获取错误")
|
|
|
Current = 0
|
|
|
return 0
|
|
|
|
|
@@ -168,7 +168,7 @@ class Get:
|
|
|
watts = Voltage*Current
|
|
|
|
|
|
GPIO.setup (pin,GPIO.IN)
|
|
|
- time.sleep(1)
|
|
|
+ time.sleep(2)
|
|
|
|
|
|
data_t = \
|
|
|
'''{4},tag=1 Voltage={0:.3f} {3:.0f}
|
|
@@ -188,7 +188,7 @@ class Get:
|
|
|
|
|
|
def Weather_data():
|
|
|
GPIO.setup (Weather_3in1,GPIO.OUT,initial=GPIO.HIGH)
|
|
|
- time.sleep(1)
|
|
|
+ time.sleep(2)
|
|
|
h = HTU21D()
|
|
|
bmp = bmp180(0x77)
|
|
|
i2c = board.I2C()
|
|
@@ -204,7 +204,7 @@ class Get:
|
|
|
global_Brightness = Brightness
|
|
|
|
|
|
GPIO.setup (Powpin_INA219,GPIO.IN)
|
|
|
- time.sleep(1)
|
|
|
+ time.sleep(2)
|
|
|
|
|
|
data_t = \
|
|
|
'''Weather,tag=Temperature Temperature={0:.3f} {5:.0f}
|
|
@@ -271,6 +271,12 @@ if __name__ == '__main__':
|
|
|
except Exception as e:
|
|
|
print(traceback.format_exc())
|
|
|
|
|
|
+ elif Parameters == "SolarPanels":
|
|
|
+ try:
|
|
|
+ Send.SolarPanels_data()
|
|
|
+ except Exception as e:
|
|
|
+ print(traceback.format_exc())
|
|
|
+
|
|
|
elif Parameters == "Weather":
|
|
|
try:
|
|
|
Send.Weather_data()
|