add if:break to restart for loop until serial data is complete

master
Jian Haake 2 years ago
parent ace762a611
commit 129712d263

@ -43,7 +43,11 @@ if __name__ == '__main__':
previous_module = "" previous_module = ""
for module in modules: #for each module inside the list of modules for module in modules: #for each module inside the list of modules
if module[0] not in module_index: #this if break is added to avoid the script from breaking at the start (which happens when serial is not yet receiving all values, but only fragments)
# print("break")
break # break and start the for loop again
function_index[module[0]](previous_module, module) #use function_index to run functions for each module function_index[module[0]](previous_module, module) #use function_index to run functions for each module
previous_module = module_index[module[0]] #use module_index to replace abbr. with full name previous_module = module_index[module[0]] #use module_index to replace abbr. with full name
if module == modules[-1]: #if module is the last module in list of modules if module == modules[-1]: #if module is the last module in list of modules
final_module = module_index[module[0]] #use name of the last module to define final_module final_module = module_index[module[0]] #use name of the last module to define final_module

Loading…
Cancel
Save