def config_set(self, config_json_dict): PymeshConfig.write_config(config_json_dict) return self.config
time.sleep(.2) pycom.rgbled(0) time.sleep(.1) pycom.rgbled(0x000066) gc.collect() return gc.enable() print("Current available memory: %d" % gc.mem_free()) pycom.heartbeat(False) # Build SD files system file_ops.sd_setup() #Load pymesh settings, ead from SD card pymesh_config = PymeshConfig.read_config() print("====================================================================") #initialize Pymesh pymesh = Pymesh(pymesh_config, new_message_cb) node = cmf.NodeFuncs(pymesh) # if mac > 10: # pymesh.end_device(True) # if mac == 20: # pymesh.leader_priority(255) # elif mac == 15: # pymesh.leader_priority(250) while not pymesh.is_connected(): print(pymesh.status_str())
# user code to be inserted, to send packet to the designated Mesh-external interface for _ in range(3): pycom.rgbled(0x888888) time.sleep(.2) pycom.rgbled(0) time.sleep(.1) return pycom.heartbeat(False) lora = LoRa(mode=LoRa.LORA, region=LoRa.EU868) lora_mac = int(str(ubinascii.hexlify(lora.mac()))[2:-1], 16) # read config file, or set default values pymesh_config = PymeshConfig.read_config(lora_mac) #initialize Pymesh pymesh = Pymesh(pymesh_config, new_message_cb) # mac = pymesh.mac() # if mac > 10: # pymesh.end_device(True) # elif mac == 5: # pymesh.leader_priority(255) while not pymesh.is_connected(): print(pymesh.status_str()) time.sleep(3) # send message to the Node having MAC address 5