@@ -1001,6 +1001,8 @@ def process_arguments():
1001
1001
cmd_parser_bootpart = subparsers .add_parser ('boot_part' , add_help = False ) # , help='Check / Set active boot partition')
1002
1002
cmd_parser_bootpart .add_argument ('-p' , '--partition' , default = None , help = "Set the activate boot partition [factory or ota_0]" )
1003
1003
1004
+ cmd_parser_pycom = subparsers .add_parser ('pycom' , help = 'Check / Set pycom parameters' )
1005
+ cmd_parser_pycom .add_argument ('--fs_type' , default = None , help = "Set the file system type ['FatFS' or 'LittleFS']" )
1004
1006
cmd_parser_sigfox = subparsers .add_parser ('sigfox' , help = 'Show/Update sigfox details' )
1005
1007
cmd_parser_sigfox .add_argument ('--id' , default = None , help = 'Update Sigfox id' )
1006
1008
cmd_parser_sigfox .add_argument ('--pac' , default = None , help = 'Update Sigfox pac' )
@@ -1294,7 +1296,7 @@ def progress_fs(msg):
1294
1296
print ("SID: %s" % sid )
1295
1297
print ("PAC: %s" % pac )
1296
1298
1297
- elif args .command == 'lpwan' or args . command == 'sigfox' :
1299
+ elif args .command == 'lpwan' :
1298
1300
config_block = nPy .read (int (PARTITIONS .get ('config' )[0 ], 16 ), int (PARTITIONS .get ('config' )[1 ], 16 ))
1299
1301
if hasattr (args , "region" ) and args .region is not None :
1300
1302
new_config_block = nPy .set_lpwan_config (config_block , args .region )
@@ -1319,9 +1321,6 @@ def progress_fs(msg):
1319
1321
print (nPy .region2str (ord (region )))
1320
1322
except :
1321
1323
print ("NONE" )
1322
- elif args .command == 'sigfox' :
1323
- print ("SID: %s" % sid )
1324
- print ("PAC: %s" % pac )
1325
1324
else :
1326
1325
print ("SMAC: %s" % smac )
1327
1326
print ("SID: %s" % sid )
@@ -1545,6 +1544,29 @@ def progress_fs(msg):
1545
1544
except :
1546
1545
print ("WIFI_ON_BOOT=[not set]" )
1547
1546
1547
+ elif args .command == 'pycom' :
1548
+ config_block = nPy .read (int (PARTITIONS .get ('config' )[0 ], 16 ), int (PARTITIONS .get ('config' )[1 ], 16 ))
1549
+ nPy .print_cb (config_block )
1550
+ if (args .fs_type is not None ):
1551
+ new_config_block = nPy .set_pycom_config (config_block , args .fs_type )
1552
+ nPy .print_cb (new_config_block )
1553
+ nPy .write (int (PARTITIONS .get ('config' )[0 ], 16 ), new_config_block )
1554
+ else :
1555
+ sys .stdout = old_stdout
1556
+ try :
1557
+ if sys .version_info [0 ] < 3 :
1558
+ fs_type = config_block [533 ]
1559
+ else :
1560
+ fs_type = config_block [533 ].to_bytes (1 , byteorder = 'little' )
1561
+ if fs_type == (b'\x00 ' ):
1562
+ print ("fs_type=FatFS" )
1563
+ if fs_type == (b'\x01 ' ):
1564
+ print ("fs_type=LittleFS" )
1565
+ if fs_type == (b'\xff ' ):
1566
+ print ("fs_type=[not set]" )
1567
+ except :
1568
+ print ("fs_type=[not set]" )
1569
+
1548
1570
elif args .command == 'pybytes' :
1549
1571
config_block = nPy .read (int (PARTITIONS .get ('config' )[0 ], 16 ), int (PARTITIONS .get ('config' )[1 ], 16 ))
1550
1572
if (hasattr (args , "token" ) and args .token is not None ) \
0 commit comments