@@ -1001,6 +1001,8 @@ def process_arguments():
10011001 cmd_parser_bootpart = subparsers .add_parser ('boot_part' , add_help = False ) # , help='Check / Set active boot partition')
10021002 cmd_parser_bootpart .add_argument ('-p' , '--partition' , default = None , help = "Set the activate boot partition [factory or ota_0]" )
10031003
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']" )
10041006 cmd_parser_sigfox = subparsers .add_parser ('sigfox' , help = 'Show/Update sigfox details' )
10051007 cmd_parser_sigfox .add_argument ('--id' , default = None , help = 'Update Sigfox id' )
10061008 cmd_parser_sigfox .add_argument ('--pac' , default = None , help = 'Update Sigfox pac' )
@@ -1294,7 +1296,7 @@ def progress_fs(msg):
12941296 print ("SID: %s" % sid )
12951297 print ("PAC: %s" % pac )
12961298
1297- elif args .command == 'lpwan' or args . command == 'sigfox' :
1299+ elif args .command == 'lpwan' :
12981300 config_block = nPy .read (int (PARTITIONS .get ('config' )[0 ], 16 ), int (PARTITIONS .get ('config' )[1 ], 16 ))
12991301 if hasattr (args , "region" ) and args .region is not None :
13001302 new_config_block = nPy .set_lpwan_config (config_block , args .region )
@@ -1319,9 +1321,6 @@ def progress_fs(msg):
13191321 print (nPy .region2str (ord (region )))
13201322 except :
13211323 print ("NONE" )
1322- elif args .command == 'sigfox' :
1323- print ("SID: %s" % sid )
1324- print ("PAC: %s" % pac )
13251324 else :
13261325 print ("SMAC: %s" % smac )
13271326 print ("SID: %s" % sid )
@@ -1545,6 +1544,29 @@ def progress_fs(msg):
15451544 except :
15461545 print ("WIFI_ON_BOOT=[not set]" )
15471546
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+
15481570 elif args .command == 'pybytes' :
15491571 config_block = nPy .read (int (PARTITIONS .get ('config' )[0 ], 16 ), int (PARTITIONS .get ('config' )[1 ], 16 ))
15501572 if (hasattr (args , "token" ) and args .token is not None ) \
0 commit comments