diff --git a/PrepareProject.py b/PrepareProject.py index 24bcdc5a..a848dbf7 100644 --- a/PrepareProject.py +++ b/PrepareProject.py @@ -223,12 +223,12 @@ allAPI_head = "" allAPI_exec = "" for activModuleName in activeModulesName: allAPI_head = allAPI_head + "\nvoid* getAPI_" + activModuleName + "(String subtype, String params);" - allAPI_exec = allAPI_exec + "\nif ((tmpAPI = getAPI_" + activModuleName + "(subtype, params)) != nullptr) return tmpAPI;" + allAPI_exec = allAPI_exec + "\nif ((tmpAPI = getAPI_" + activModuleName + "(subtype, params)) != nullptr) foundAPI = tmpAPI;" apicpp = '#include "ESPConfiguration.h"\n' apicpp = apicpp + allAPI_head -apicpp = apicpp + '\n\nvoid* getAPI(String subtype, String params) {\nvoid* tmpAPI;' +apicpp = apicpp + '\n\nvoid* getAPI(String subtype, String params) {\nvoid* tmpAPI; void* foundAPI = nullptr;' apicpp = apicpp + allAPI_exec -apicpp = apicpp + '\nreturn nullptr;\n}' +apicpp = apicpp + '\nreturn foundAPI;\n}' with open('src/modules/API.cpp', 'w') as f: f.write(apicpp)