lcdota web
This commit is contained in:
parent
29171e2a01
commit
6cb4818195
4 changed files with 104 additions and 13 deletions
|
@ -624,7 +624,7 @@ void ESPMegaDisplay::giveSerialMutex()
|
|||
* @param size The size of the update.
|
||||
* @return True if the OTA update is started, false otherwise.
|
||||
*/
|
||||
bool ESPMegaDisplay::beginOTA(size_t size)
|
||||
bool ESPMegaDisplay::beginUpdate(size_t size)
|
||||
{
|
||||
if (xSemaphoreTake(this->serialMutex, DISPLAY_MUTEX_TAKE_TIMEOUT) == pdFALSE)
|
||||
{
|
||||
|
@ -658,7 +658,7 @@ bool ESPMegaDisplay::beginOTA(size_t size)
|
|||
{
|
||||
if (this->displayAdapter->read() == 0x05)
|
||||
{
|
||||
ESP_LOGV("ESPMegaDisplay", "LCD OTA Subroutine is ready to receive data.");
|
||||
ESP_LOGV("ESPMegaDisplay", "LCD Update Subroutine is ready to receive data.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -666,22 +666,22 @@ bool ESPMegaDisplay::beginOTA(size_t size)
|
|||
// FLush the serial recieve buffer
|
||||
while (this->displayAdapter->available())
|
||||
this->displayAdapter->read();
|
||||
ESP_LOGE("ESPMegaDisplay", "LCD OTA Subroutine failed to initialize.");
|
||||
ESP_LOGE("ESPMegaDisplay", "LCD Update Subroutine failed to initialize.");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes data to the display during an OTA update.
|
||||
* @brief Writes data to the display during an update.
|
||||
* @param data The data to write.
|
||||
* @param size The size of the data.
|
||||
* @return True if the data is written, false otherwise.
|
||||
*/
|
||||
bool ESPMegaDisplay::writeOTA(uint8_t *data, size_t size)
|
||||
bool ESPMegaDisplay::writeUpdate(uint8_t *data, size_t size)
|
||||
{
|
||||
// Check if the data size is too large
|
||||
if(size>4096)
|
||||
{
|
||||
ESP_LOGE("ESPMegaDisplay", "LCD OTA Subroutine failed to write data, data size is too large.");
|
||||
ESP_LOGE("ESPMegaDisplay", "LCD Update Subroutine failed to write data, data size is too large.");
|
||||
return false;
|
||||
}
|
||||
// Flush the serial recieve buffer
|
||||
|
@ -699,19 +699,19 @@ bool ESPMegaDisplay::writeOTA(uint8_t *data, size_t size)
|
|||
{
|
||||
if (this->displayAdapter->read() == 0x05)
|
||||
{
|
||||
ESP_LOGV("ESPMegaDisplay", "LCD OTA Subroutine is ready to receive data.");
|
||||
ESP_LOGV("ESPMegaDisplay", "LCD Update Subroutine is ready to receive data.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
ESP_LOGE("ESPMegaDisplay", "LCD OTA Subroutine failed to write data.");
|
||||
ESP_LOGE("ESPMegaDisplay", "LCD Update Subroutine failed to write data.");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Ends an LCD OTA update.
|
||||
* @brief Ends an LCD update.
|
||||
*/
|
||||
void ESPMegaDisplay::endOTA()
|
||||
void ESPMegaDisplay::endUpdate()
|
||||
{
|
||||
xSemaphoreGive(this->serialMutex);
|
||||
this->reset();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue