MCPcopy Create free account
hub / github.com/BruceDevices/firmware / loadScriptFromSD

Function loadScriptFromSD

src/modules/ble/BLE_Suite.cpp:2937–2959  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2935}
2936
2937bool loadScriptFromSD(String filename) {
2938 if (!SD.begin()) {
2939 showErrorMessage("SD Card failed");
2940 return false;
2941 }
2942
2943 File file = SD.open(filename);
2944 if (!file) {
2945 String errorMsg = "Cannot open file: " + filename;
2946 showErrorMessage(errorMsg.c_str());
2947 return false;
2948 }
2949
2950 globalScript = "";
2951 while (file.available()) globalScript += (char)file.read();
2952 file.close();
2953
2954 if (globalScript.length() == 0) {
2955 showErrorMessage("File is empty");
2956 return false;
2957 }
2958 return true;
2959}
2960
2961String getScriptFromUser() {
2962 const int MAX_SCRIPTS = 10;

Callers 1

getScriptFromUserFunction · 0.85

Calls 5

showErrorMessageFunction · 0.85
closeMethod · 0.80
beginMethod · 0.45
availableMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected