8000 Update updater.py and disable pybytes in Jenkins · daq-tools/pycom-micropython@77b511a · GitHub
[go: up one dir, main page]

Skip to content

Commit 77b511a

Browse files
committed
Update updater.py and disable pybytes in Jenkins
1 parent 3e7e176 commit 77b511a

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

Jenkinsfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ def flashBuild(short_name, version, variant) {
8585
unstash 'esp32Tools'
8686
unstash 'tests'
8787
unstash 'tools'
88-
sh 'python esp32/tools/fw_updater/updater.py --port ' + device_name +' flash -t esp32/build-' + variant + '/' + board_name + '-' + version + '.tar.gz'
89-
}
88+
sh 'python esp32/tools/fw_updater/updater.py --noexit --port ' + device_name +' flash -t esp32/build-' + variant + '/' + board_name + '-' + version + '.tar.gz'
89+
sh 'python esp32/tools/fw_updater/updater.py --port ' + device_name +' pybytes --auto_start False'
9090
}
9191
}
9292

esp32/tools/fw_updater/updater.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python2
22

3-
# Copyright (c) 2016-2019, Pycom Limited.
3+
# Copyright (c) 2016-2020, Pycom Limited.
44
#
55
# This software is licensed under the GNU GPL version 3 or any
66
# later version, with permitted additional terms. For more information
@@ -751,10 +751,11 @@ def set_pycom_config(self, config_block, boot_fs_type=None):
751751
return self.set_pybytes_config(new_config_block, force_update=True)
752752

753753
def print_cb(self, config_block):
754-
for x in range(0, 30):
755-
print(binascii.hexlify(config_block[x * 32:x * 32 + 32]))
754+
if DEBUG:
755+
for x in range(0, 30):
756+
print(binascii.hexlify(config_block[x * 32:x * 32 + 32]))
756757

757-
def set_pybytes_config(self, config_block, userid=None, device_token=None, mqttServiceAddress=None, network_preferences=None, extra_preferences=None, force_update=None):
758+
def set_pybytes_config(self, config_block, userid=None, device_token=None, mqttServiceAddress=None, network_preferences=None, extra_preferences=None, force_update=None, auto_start=None):
758759
config_block = config_block.ljust(int(PARTITIONS.get('config')[1], 16), b'\x00')
759760
if device_token is not None:
760761
token = str(device_token)[0:39].ljust(40, b'\x00')
@@ -789,14 +790,23 @@ def set_pybytes_config(self, config_block, userid=None, device_token=None, mqttS
789790
else:
790791
fu = config_block[497]
791792

793+
if auto_start is not None:
794+
if auto_start:
795+
asf = b'\x01'
796+
else:
797+
asf = b'\x00'
798+
else:
799+
asf = config_block[498]
800+
792801
new_config_block = config_block[0:162] \
793802
+token \
794803
+address \
795804
+uid \
796805
+nwp \
797806
+ep \
798807
+fu \
799-
+config_block[498:]
808+
+asf \
809+
+config_block[499:]
800810

801811
# self.print_cb(new_config_block)
802812
return new_config_block
@@ -972,7 +982,8 @@ def process_arguments():
972982
cmd_parser_pybytes.add_argument('--type', default=None, help='Set LTE type')
973983
cmd_parser_pybytes.add_argument('--cid', default=None, help='Set LTE cid')
974984
cmd_parser_pybytes.add_argument('--band', default=None, help='Set LTE band')
975-
cmd_parser_pybytes.add_argument('--reset', default=None, help='Set LTE reset')
985+
cmd_parser_pybytes.add_argument('--lte_reset', default=None, type=str2bool, nargs='?', const=True, help='Set LTE reset')
986+
cmd_parser_pybytes.add_argument('--auto_start', default=None, type=str2bool, nargs='?', const=True, help='Set Pybytes auto_start')
976987

977988
cmd_parser_cb = subparsers.add_parser('cb', help='Read/Write config block')
978989
cmd_parser_cb.add_argument('-f', '--file', default=None, help='name of the backup file (default: <wmac>.cb)')
@@ -1444,16 +1455,16 @@ def progress_fs(msg):
14441455
or (hasattr(args, "mqtt") and args.mqtt is not None) \
14451456
or (hasattr(args, "uid") and args.uid is not None) \
14461457
or (hasattr(args, "nwprefs") and args.nwprefs is not None) \
1458+
or (hasattr(args, "auto_start") and args.auto_start is not None) \
14471459
or (hasattr(args, "carrier") and args.carrier is not None) \
14481460
or (hasattr(args, "apn") and args.apn is not None) \
14491461
or (hasattr(args, "type") and args.type is not None) \
14501462
or (hasattr(args, "cid") and args.cid is not None) \
14511463
or (hasattr(args, "band") and args.band is not None) \
1452-
or (hasattr(args, "reset") and args.reset is not None) \
1464+
or (hasattr(args, "lte_reset") and args.lte_reset is not None) \
14531465
or (hasattr(args, "extraprefs") and args.extraprefs is not None):
1454-
new_config_block = nPy.set_pybytes_config(config_block, args.uid, args.token, args.mqtt, args.nwprefs, args.extraprefs, True)
1466+
new_config_block = nPy.set_pybytes_config(config_block, args.uid, args.token, args.mqtt, args.nwprefs, args.extraprefs, True, args.auto_start)
14551467
new_config_block = nPy.set_lte_config(new_config_block, args.carrier, args.apn, args.type, args.cid, args.band, args.reset)
1456-
print(nPy.print_cb(new_config_block))
14571468
nPy.write(int(PARTITIONS.get('config')[0], 16), new_config_block)
14581469
sys.stdout = old_stdout
14591470
else:

0 commit comments

Comments
 (0)
0