diff --git a/.gitignore b/.gitignore index a4a37ad..8b617f4 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ .vscode/ .vscode/settings.json firmware/ -release/ \ No newline at end of file +release/ +.vscode/extensions.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index ee32b37..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "C_Cpp.errorSquiggles": "enabled", - "files.associations": { - "*.cps": "javascript", - "string": "cpp", - "optional": "cpp", - "istream": "cpp", - "ostream": "cpp", - "system_error": "cpp", - "array": "cpp", - "functional": "cpp", - "tuple": "cpp", - "type_traits": "cpp", - "utility": "cpp", - "*.d": "cpp", - "*.html": "cpp", - "*.tcc": "cpp", - "regex": "cpp" - }, - "C_Cpp_Runner.msvcBatchPath": "", - "C_Cpp_Runner.cCompilerPath": "gcc", - "C_Cpp_Runner.cppCompilerPath": "g++", - "C_Cpp_Runner.debuggerPath": "gdb", - "C_Cpp_Runner.cStandard": "", - "C_Cpp_Runner.cppStandard": "", - "C_Cpp_Runner.useMsvc": false, - "C_Cpp_Runner.warnings": [ - "-Wall", - "-Wextra", - "-Wpedantic", - "-Wshadow", - "-Wformat=2", - "-Wcast-align", - "-Wconversion", - "-Wsign-conversion", - "-Wnull-dereference" - ], - "C_Cpp_Runner.msvcWarnings": [ - "/W4", - "/permissive-", - "/w14242", - "/w14287", - "/w14296", - "/w14311", - "/w14826", - "/w44062", - "/w44242", - "/w14905", - "/w14906", - "/w14263", - "/w44265", - "/w14928" - ], - "C_Cpp_Runner.enableWarnings": true, - "C_Cpp_Runner.warningsAsError": false, - "C_Cpp_Runner.compilerArgs": [], - "C_Cpp_Runner.linkerArgs": [], - "C_Cpp_Runner.includePaths": [], - "C_Cpp_Runner.includeSearch": [ - "*", - "**/*" - ], - "C_Cpp_Runner.excludeSearch": [ - "**/build", - "**/build/**", - "**/.*", - "**/.*/**", - "**/.vscode", - "**/.vscode/**" - ], - "C_Cpp_Runner.useAddressSanitizer": false, - "C_Cpp_Runner.useUndefinedSanitizer": false, - "C_Cpp_Runner.useLeakSanitizer": false, - "C_Cpp_Runner.showCompilationTime": false, - "C_Cpp_Runner.useLinkTimeOptimization": false, - "C_Cpp_Runner.msvcSecureNoWarnings": false, - "cmake.sourceDirectory": "D:/Git/iot-firmware/.pio/libdeps/full/Adafruit BusIO" -} \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index dcf9353..af7a9cf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { stages { stage('Build') { steps { - git branch: 'main', url: 'https://git.siwatsystem.com/ise-senior-iot/iot-firmware.git' + git branch: 'lcd_upload', url: 'https://git.siwatsystem.com/ise-senior-iot/iot-firmware.git' sh 'export PLATFORMIO_PATH=/root/.platformio/penv/bin/platformio' sh '/usr/bin/python3 gen_release.py' stash includes: 'release/**/*', name: 'release_binaries' diff --git a/src/espmega_iot_core.cpp b/src/espmega_iot_core.cpp index 845de70..1135a0f 100644 --- a/src/espmega_iot_core.cpp +++ b/src/espmega_iot_core.cpp @@ -547,6 +547,24 @@ void ota_begin() } } }); + otaserver.on("/lcd_update",HTTP_POST,[]() { + otaserver.sendHeader("Connection","close"); + },[](){ + for(int i=0;i #include +int lcd_byte_counter = 0; + /** * @brief Sends stop bit to LCD. - * + * * This function sends a stop bit to the LCD. It is only enabled if the ENABLE_INTERNAL_LCD macro is defined. */ void lcd_send_stop_bit() @@ -17,7 +19,7 @@ void lcd_send_stop_bit() /** * Sends a command to the LCD display. - * + * * @param command The command to send to the LCD display. */ void lcd_send_command(String command) @@ -31,9 +33,9 @@ void lcd_send_command(String command) /** * @brief Resets the LCD display. - * + * * If ENABLE_INTERNAL_LCD is defined, sends a reset command to the LCD display. - * + * */ void lcd_reset() { @@ -57,7 +59,7 @@ void lcd_init() /** * @brief Starts the upload process to the LCD. - * + * * @param size The size of the data to be uploaded. * @return true if the upload process started successfully, false otherwise. */ @@ -70,14 +72,16 @@ bool lcd_upload_start(size_t size) Serial.print("connect"); lcd_send_stop_bit(); delay(1000); - Serial.print("whmi-wri 1024,115200,res0"); + Serial.print("whmi-wri "); + Serial.print(size); + Serial.print(",115200,res0"); lcd_send_stop_bit(); - lcd_wait_ack(); + return lcd_wait_ack(); } /** * Writes data to the LCD upload buffer. - * + * * @param data Pointer to the data to be written. * @param size Size of the data to be written. * @return True if the write was successful, false otherwise. @@ -87,9 +91,15 @@ bool lcd_upload_write(uint8_t *data, size_t size) for (int i = 0; i < size; i++) { Serial.write(data[i]); + lcd_byte_counter++; + if (lcd_byte_counter == 4096) + { + lcd_wait_ack(); + lcd_byte_counter = 0; + } } + return true; } - /** * Waits for an acknowledgement signal from the LCD. * @return true if acknowledgement signal is received, false otherwise. @@ -97,12 +107,15 @@ bool lcd_upload_write(uint8_t *data, size_t size) bool lcd_wait_ack() { bool data_ok = false; - for (int i; i < 50; i++) + for (int i = 0; i < 50; i++) { - if (Serial.read() == 0x05) + if (Serial.available()) { - data_ok = true; - break; + if (Serial.read() == 0x05) + { + data_ok = true; + break; + } } delay(100); } diff --git a/src/ota_html/ota-part3.html b/src/ota_html/ota-part3.html index 4826dbf..4c7daee 100644 --- a/src/ota_html/ota-part3.html +++ b/src/ota_html/ota-part3.html @@ -23,11 +23,14 @@ R"=====(