| 2935 | } |
| 2936 | |
| 2937 | bool 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 | |
| 2961 | String getScriptFromUser() { |
| 2962 | const int MAX_SCRIPTS = 10; |
no test coverage detected