Esempio n. 1
0
 def __init__(self, watchdog_time):
     sfw.watchdog(0, watchdog_time)
     port_expander = sx1503.SX1503(I2C0, 400000)
     gpio.add_expander(1, port_expander, pinmap)
     gpio.mode(LED_R, OUTPUT)
     gpio.mode(LED_G, OUTPUT)
     gpio.mode(LED_B, OUTPUT)
     gpio.mode(RS485EN, OUTPUT)
     gpio.low(LED_G)
     gpio.low(LED_R)
     gpio.high(LED_B)
     gpio.low(RS485EN)
     self.port = streams.serial(drvname=SERIAL1,
                                baud=9600,
                                set_default=False)
Esempio n. 2
0
    print("Starting Accelerometer...")
    import accel
    accel.start()
    print("Starting GNSS...")
    gnss.start()
    gnss.set_rate(2000)

    print("Starting Modem...")
    modem.startup()
    
    # enable modem/gnss utilities
    utils.modem = modem
    utils.gnss = gnss

    sfw.watchdog(0, 30000)
    sfw.kick()
    if utils.check_terminal(s):
        utils.do_terminal(s)

    minfo = gsm.mobile_info()
    print("Modem:", minfo)
    
    # enable SMS checking
    utils.check_sms = True
except Exception as e:
    print("Failed init hw with", e)
    sleep(500)
    mcu.reset()

Esempio n. 3
0
# Check for reset reason
try:
    print("Watchdog triggered:",sfw.watchdog_triggered())
except Exception as e:
    print("Watchdog not suppported by this Virtual Machine!")
    while True:
        sleep(1000)

# Do something without fearing a reset
for x in range(10):
    sleep(1000)
    print("Printing something for a while, no watchdog can reset me! 8‑D")



# Configure watchdog in normal mode with a 5 seconds timeout
print("Configuring watchdog to a 5 seconds timeout...")
sfw.watchdog(0,5000)
sleep(100)

# Kick the watchdog every second
for x in range(10):
    sleep(1000)
    sfw.kick()
    print("Kick!")
    
# Stop kicking and wait for reset
while True:
    print("Printing something for a while waiting for the watchdog! D-8")
    sleep(1000)
    
Esempio n. 4
0
###############################################################################

from bsp.drivers import wifi
import streams
from zdm import zdm
import threading as th
import sfw
import mcu
from fourzerobox import fourzerobox

# Lock for sync
core_sample_lock = th.Lock()
ready = True

# Set Watchdog timeout
sfw.watchdog(0, 60000)

# Init sys
streams.serial()
print('init')

# Reference table for no linear NTC sensor
ref_table = [
    329.5, 247.7, 188.5, 144.1, 111.3, 86.43, 67.77, 53.41, 42.47, 33.90,
    27.28, 22.05, 17.96, 14.69, 12.09, 10.00, 8.313, 6.940, 5.827, 4.911,
    4.160, 3.536, 3.020, 2.588, 2.228, 1.924, 1.668, 1.451, 1.266, 1.108,
    0.9731, 0.8572, 0.7576
]

# FourZero Var
fzbox = None
Esempio n. 5
0
# called periodically thanks to a timer.

import streams                                          # For printing to serial out
import timers                                           # For timing the channel analysis
from espressif.esp32net import esp32wifi as wifi_driver # For driving the esp32 WiFi chip
import requests
from wireless import wifi
import mcu
import gc
import json
import math
import rtc
import sfw
from zdm import zdm 

sfw.watchdog(0, 120000)

number_of_channels = 13                             # Total number of channels following the IEEE 802.11 norm in Europe
channel_activity_stats = [0] * number_of_channels   # A list of channel activity
t = timers.timer()                                  # A timer to time the calls to the analysis function


SSID = ' '
PASSWORD = '******'
DEVICEID = ' '
JWT = ' '
TAG='wifiSniffer'

device=None

# Initialize serial out & WiFi chip