This commit is contained in:
uhi22 2024-07-23 21:01:30 +02:00
commit d075f4d088

View file

@ -30,20 +30,42 @@ def cbShowStatus(s, selection=""):
def testBlockingBeep(patternselection): def testBlockingBeep(patternselection):
if (patternselection==1): if (patternselection==1):
# The "MAC Found" beep
p.ChangeDutyCycle(10) p.ChangeDutyCycle(10)
p.ChangeFrequency(1200) p.ChangeFrequency(1100)
time.sleep(0.2) time.sleep(0.3)
p.ChangeFrequency(1300) p.ChangeFrequency(1300)
time.sleep(0.2) time.sleep(0.3)
p.ChangeFrequency(1400) p.ChangeFrequency(1500)
time.sleep(0.2) time.sleep(0.3)
p.ChangeDutyCycle(0) p.ChangeDutyCycle(0)
if (patternselection==2): if (patternselection==2):
# The short "ok" beep
p.ChangeDutyCycle(10) p.ChangeDutyCycle(10)
p.ChangeFrequency(1600) p.ChangeFrequency(1600)
time.sleep(0.2) time.sleep(0.07)
p.ChangeFrequency(1500) p.ChangeDutyCycle(0)
time.sleep(0.2) if (patternselection==3):
# The "no GPS position" beep
print("no pos beep 4")
p.ChangeDutyCycle(10)
p.ChangeFrequency(1700)
time.sleep(0.04)
p.ChangeDutyCycle(0)
time.sleep(0.04)
p.ChangeDutyCycle(10)
p.ChangeFrequency(1700)
time.sleep(0.04)
p.ChangeDutyCycle(0)
time.sleep(0.04)
p.ChangeDutyCycle(10)
p.ChangeFrequency(1700)
time.sleep(0.04)
p.ChangeDutyCycle(0)
time.sleep(0.04)
p.ChangeDutyCycle(10)
p.ChangeFrequency(1700)
time.sleep(0.04)
p.ChangeDutyCycle(0) p.ChangeDutyCycle(0)
def trySomeHttp(): def trySomeHttp():
@ -54,9 +76,16 @@ def trySomeHttp():
strChargerMac = "chargerMac=" + worker.addressManager.getEvseMacAsStringAndClearUpdateFlag().replace(":", "") strChargerMac = "chargerMac=" + worker.addressManager.getEvseMacAsStringAndClearUpdateFlag().replace(":", "")
strParams = strChargerMac strParams = strChargerMac
strParams = strParams + "&loops="+str(nMainloops)+"&pos="+strGpsPos strParams = strParams + "&loops="+str(nMainloops)+"&pos="+strGpsPos
print(strParams)
try: try:
contents = urllib.request.urlopen(strLoggingUrl + "?" + strParams).read() contents = urllib.request.urlopen(strLoggingUrl + "?" + strParams).read()
testBlockingBeep(2) print(len(strGpsPos))
if (len(strGpsPos)>7):
print("Valid GPS coordinates, and http logging worked")
testBlockingBeep(2)
else:
print("http was ok, but no GPS position")
testBlockingBeep(3)
except Exception as err: except Exception as err:
contents = "(no contents received) " + str(err) contents = "(no contents received) " + str(err)
print(contents) print(contents)
@ -121,7 +150,8 @@ worker=pyPlcWorker.pyPlcWorker(cbAddToTrace, cbShowStatus, myMode, isSimulationM
nMainloops=0 nMainloops=0
httpTime_ms = round(time.time()*1000) httpTime_ms = round(time.time()*1000)
testTime_ms = httpTime_ms testTime_ms = httpTime_ms
intervalForHttpLogging_ms = 120*1000 # each 2 minutes send the logging data to the server #intervalForHttpLogging_ms = 120*1000 # each 2 minutes send the logging data to the server
intervalForHttpLogging_ms = 30*1000 # each half minute send the logging data to the server
soundstate = 0 soundstate = 0
GPIO.setmode(GPIO.BCM) GPIO.setmode(GPIO.BCM)