Exemple #1
0
def features(on=None):
    if on is None:
        print("heartbeat   ", pycom.heartbeat_on_boot())
        print("lte         ", pycom.lte_modem_en_on_boot())
        try:
            print("pybytes     ", pycom.pybytes_on_boot())
        except:
            pass
        try:
            print("smart_config", pycom.smart_config_on_boot())
        except:
            pass
        print("wdt         ", pycom.wdt_on_boot())
        print("wifi        ", pycom.wifi_on_boot())
    else:
        print("configure all features as", on)
        pycom.heartbeat_on_boot(on)
        pycom.lte_modem_en_on_boot(on)
        try:
            pycom.pybytes_on_boot(on)
        except:
            pass
        try:
            pycom.smart_config_on_boot(on)
        except:
            pass
        pycom.wdt_on_boot(on)
        pycom.wifi_on_boot(on)
        features(None)
Exemple #2
0
def set_persistent_settings():
    _logger.info("Setting persistent settings...")
    pycom.wifi_on_boot(False)
    pycom.lte_modem_en_on_boot(False)
    pycom.heartbeat_on_boot(False)
    pycom.wdt_on_boot(True)
    pycom.wdt_on_boot_timeout(1000 * 30)
Exemple #3
0
 def configure_rgb_led(self):
     """https://docs.pycom.io/tutorials/all/rgbled.html"""
     if self.platform_info.vendor == self.platform_info.MICROPYTHON.Pycom:
         import pycom
         # Enable or disable heartbeat.
         rgb_led_heartbeat = self.settings.get('main.rgb_led.heartbeat', True)
         terkin_blink_pattern = self.settings.get('main.rgb_led.terkin', False)
         if terkin_blink_pattern:
             rgb_led_heartbeat = False
         pycom.heartbeat(rgb_led_heartbeat)
         pycom.heartbeat_on_boot(rgb_led_heartbeat)
Exemple #4
0
 def configure_rgb_led(self):
     """
     https://docs.pycom.io/tutorials/all/rgbled.html
     """
     if self.application_info.platform_info.vendor == MicroPythonPlatform.Pycom:
         import pycom
         # Enable or disable heartbeat.
         rgb_led_heartbeat = self.settings.get('main.rgb_led.heartbeat',
                                               True)
         pycom.heartbeat(rgb_led_heartbeat)
         pycom.heartbeat_on_boot(rgb_led_heartbeat)
Exemple #5
0
    def configure_rgb_led(self):
        """
        https://docs.pycom.io/tutorials/all/rgbled.html
        """
        import pycom

        # Enable or disable heartbeat.
        rgb_led_heartbeat = self.settings.get('main.rgb_led.heartbeat', True)
        pycom.heartbeat(rgb_led_heartbeat)
        pycom.heartbeat_on_boot(rgb_led_heartbeat)

        # Alternative signalling.
        # Todo: Run this in a separate thread in order not to delay execution of main program flow.
        if not rgb_led_heartbeat:
            for _ in range(2):
                pycom.rgbled(0x001100)
                time.sleep(0.15)
                pycom.rgbled(0x000000)
                time.sleep(0.10)
def show_boot_flags():
    _logger.info("pycom.wifi_on_boot():         %s", pycom.wifi_on_boot())
    with CheckStep(FLAG_LTE_FW_API, suppress_exception=True):
        # These methods are not available on old firmware versions
        # If they are missing, we need to upgrade the Pycom firmware
        _logger.info("pycom.lte_modem_en_on_boot(): %s",
                     pycom.lte_modem_en_on_boot())
        _logger.info("pycom.heartbeat_on_boot():    %s",
                     pycom.heartbeat_on_boot())
        _logger.info("pycom.wdt_on_boot():          %s", pycom.wdt_on_boot())
        _logger.info("pycom.wdt_on_boot_timeout():  %s",
                     pycom.wdt_on_boot_timeout())
Exemple #7
0
import pycom

from wlanmanager import WLanManager
from network import WLAN

###############################################################################
# Disable LED heartbeat on boot                                               #
###############################################################################

if pycom.heartbeat_on_boot():
    pycom.heartbeat_on_boot(False)
    pycom.heartbeat(False)

###############################################################################
# Start of boot.py, yellow LED until it is finished                           #
###############################################################################

print("Starting boot process...")
pycom.rgbled(0x111100)

###############################################################################
# Disable automatic start of WLan device                                      #
###############################################################################

if pycom.wifi_on_boot():
    pycom.wifi_on_boot(False)

###############################################################################
# Initial scan of available WLan SSIDS                                        #
###############################################################################
Exemple #8
0

if __name__ == '__main__':
    import binascii
    import machine
    uid = binascii.hexlify(machine.unique_id()).decode("utf-8")
    name = os.uname().sysname.lower() + '-' + uid[-4:]
    print(name, uid)

    features()
    if False:
        features(True)  # turn everything on
        features(False)  # turn everything off
        # print
        import pycom
        print('heartbeat', pycom.heartbeat_on_boot())
        print('lte', pycom.lte_modem_en_on_boot())
        print('pybytes', pycom.pybytes_on_boot())
        print('smart_config', pycom.smart_config_on_boot())
        print('wdt', pycom.wdt_on_boot())
        print('wifi', pycom.wifi_on_boot())
        # off
        pycom.heartbeat_on_boot(False)
        import pycom
        pycom.lte_modem_en_on_boot(False)
        pycom.wdt_on_boot(False)
        pycom.wifi_on_boot(False)
        pycom.smart_config_on_boot(False)
        pycom.pybytes_on_boot(False)
        # on
        pycom.heartbeat_on_boot(True)