@@ -57,20 +57,24 @@ def update_device_network_config(self, fcota, config):
5757 def get_current_version (self ):
5858 return os .uname ().release
5959
60- def get_update_manifest (self ):
60+ def get_update_manifest (self , fwtype = None , token = None ):
6161 current_version = self .get_current_version ()
6262 sysname = os .uname ().sysname
6363 wmac = hexlify (machine .unique_id ()).decode ('ascii' )
64- request_template = "manifest.json?current_ver={}&sysname={}&wmac={}&ota_slot={}"
65- req = request_template .format (current_version , sysname , wmac , hex (pycom .ota_slot ()))
64+ if fwtype == 'pymesh' :
65+ request_template = "manifest.json?current_ver={}&sysname={}&token={}&ota_slot={}&wmac={}&fwtype={}"
66+ req = request_template .format (current_version , sysname , token , hex (pycom .ota_slot ()), wmac .upper (), fwtype )
67+ else :
68+ request_template = "manifest.json?current_ver={}&sysname={}&wmac={}&ota_slot={}"
69+ req = request_template .format (current_version , sysname , wmac , hex (pycom .ota_slot ()))
6670 manifest_data = self .get_data (req ).decode ()
6771 manifest = ujson .loads (manifest_data )
6872 gc .collect ()
6973 return manifest
7074
71- def update (self , customManifest = None ):
75+ def update (self , customManifest = None , fwtype = None , token = None ):
7276 try :
73- manifest = self .get_update_manifest () if not customManifest else customManifest
77+ manifest = self .get_update_manifest (fwtype , token ) if not customManifest else customManifest
7478 except Exception as e :
7579 print ('Error reading the manifest, aborting: {}' .format (e ))
7680 return 0
@@ -240,7 +244,6 @@ def get_data(self, req, dest_path=None, hash=False, firmware=False):
240244 fp = open (dest_path , 'wb' )
241245
242246 if firmware :
243- print ('start' )
244247 pycom .ota_start ()
245248
246249 h = uhashlib .sha1 ()
0 commit comments