Commit 7805f12b authored by Giacomo Lavermicocca's avatar Giacomo Lavermicocca
Browse files

add try and except

parent 69be7a17
Loading
Loading
Loading
Loading
+16 −9
Original line number Diff line number Diff line
@@ -2,8 +2,15 @@
import esp
esp.osdebug(None)
import gc
import webrepl
webrepl.start()
gc.collect()

#import ccalendar
#ccalendar.getEvents("")

import cconnect

try:
    cconnect.do_connect()
except Exception as e:
    print("Error found in boot.py" + str(e))
+37 −23
Original line number Diff line number Diff line
@@ -2,23 +2,37 @@ import uurequests
import time
import machine
import network
import gc

def getEvents(param):
    led = machine.Pin(2, machine.Pin.OUT)
    sta_if = network.WLAN(network.STA_IF)
    ap_if = network.WLAN(network.AP_IF)
    ap_if.active(False)

    while True:
        text = "No events yet..."

        if sta_if.isconnected() == True:
            print("NEW REQUEST")
            print(sta_if.ifconfig())
            r = uurequests.get("https://script.google.com/macros/s/AKfycbyz55y8cdFmtX31yiOOuPn5SLGdGOuL6KvPOorfZZEmvzUppo0/exec")
            print(r.text)
            print(sta_if.ifconfig())
            text = r.text
        else:
            print("No connecttion to router")
        for i in range(15):
            import cconnect
            cconnect.make_connect()
            print("NEW REQUEST AFTER RECONNECT")
            r = uurequests.get("https://script.google.com/macros/s/AKfycbyz55y8cdFmtX31yiOOuPn5SLGdGOuL6KvPOorfZZEmvzUppo0/exec")
            print(r.text)
            text = r.text
        for i in range(120):
            print("FreeMem" + str(gc.mem_free()))
            led.on()
            time.sleep(1)
            led.off()
            time.sleep(1)
            print(".")
            print(text)

print("Welcome to calendar eventsssss")

ccalendar/boot.py

deleted100644 → 0
+0 −16
Original line number Diff line number Diff line
# This file is executed on every boot (including wake-boot from deepsleep)
import esp
esp.osdebug(None)
import gc
gc.collect()

#import ccalendar
#ccalendar.getEvents("")

import cconnect

try:
    cconnect.do_connect()
except Exception as e:
    print("Error found in boot.py" + str(e))

ccalendar/ccalendar.py

deleted100644 → 0
+0 −38
Original line number Diff line number Diff line
import uurequests
import time
import machine
import network
import gc

def getEvents(param):
    led = machine.Pin(2, machine.Pin.OUT)
    sta_if = network.WLAN(network.STA_IF)
    ap_if = network.WLAN(network.AP_IF)
    ap_if.active(False)

    while True:
        text = "No events yet..."

        if sta_if.isconnected() == True:
            print("NEW REQUEST")
            print(sta_if.ifconfig())
            r = uurequests.get("https://script.google.com/macros/s/AKfycbyz55y8cdFmtX31yiOOuPn5SLGdGOuL6KvPOorfZZEmvzUppo0/exec")
            print(r.text)
            text = r.text
        else:
            import cconnect
            cconnect.make_connect()
            print("NEW REQUEST AFTER RECONNECT")
            r = uurequests.get("https://script.google.com/macros/s/AKfycbyz55y8cdFmtX31yiOOuPn5SLGdGOuL6KvPOorfZZEmvzUppo0/exec")
            print(r.text)
            text = r.text
        for i in range(120):
            print("FreeMem" + str(gc.mem_free()))
            led.on()
            time.sleep(1)
            led.off()
            time.sleep(1)
            print(text)

print("Welcome to calendar eventsssss")
+793 −0

File changed and moved.

Preview size limit exceeded, changes collapsed.