fix internal display pwm adjustment bug

This commit is contained in:
Siwat Sirichai 2024-02-16 01:23:59 +07:00
parent 06b69da78f
commit 8988b59103
3 changed files with 7 additions and 6 deletions

View File

@ -507,7 +507,7 @@ void ESPMegaDisplay::reset()
* @brief Constructor for the ESPMegaDisplay class. * @brief Constructor for the ESPMegaDisplay class.
* @param displayAdapter The serial adapter connected to the display. * @param displayAdapter The serial adapter connected to the display.
*/ */
ESPMegaDisplay::ESPMegaDisplay(HardwareSerial *displayAdapter, uint16_t baudRate, uint16_t uploadBaudRate, uint8_t txPin, uint8_t rxPin) ESPMegaDisplay::ESPMegaDisplay(HardwareSerial *displayAdapter, uint32_t baudRate, uint32_t uploadBaudRate, uint8_t txPin, uint8_t rxPin)
{ {
this->baudRate = baudRate; this->baudRate = baudRate;
this->uploadBaudRate = uploadBaudRate; this->uploadBaudRate = uploadBaudRate;
@ -657,7 +657,7 @@ bool ESPMegaDisplay::beginUpdate(size_t size)
* @note The baud rate that is used to transfer the data is defined by the uploadBaudRate parameter in the constructor. * @note The baud rate that is used to transfer the data is defined by the uploadBaudRate parameter in the constructor.
* @return True if the OTA update is started, false otherwise. * @return True if the OTA update is started, false otherwise.
*/ */
bool ESPMegaDisplay::beginUpdate(size_t size, uint16_t baudRate) bool ESPMegaDisplay::beginUpdate(size_t size, uint32_t baudRate)
{ {
if (xSemaphoreTake(this->serialMutex, DISPLAY_MUTEX_TAKE_TIMEOUT) == pdFALSE) if (xSemaphoreTake(this->serialMutex, DISPLAY_MUTEX_TAKE_TIMEOUT) == pdFALSE)
{ {

View File

@ -17,7 +17,7 @@
class ESPMegaDisplay class ESPMegaDisplay
{ {
public: public:
ESPMegaDisplay(HardwareSerial *displayAdapter, uint16_t baudRate, uint16_t uploadBaudRate, uint8_t txPin, uint8_t rxPin); ESPMegaDisplay(HardwareSerial *displayAdapter, uint32_t baudRate, uint32_t uploadBaudRate, uint8_t txPin, uint8_t rxPin);
void begin(); void begin();
void loop(); void loop();
void reset(); void reset();
@ -39,13 +39,13 @@ class ESPMegaDisplay
void giveSerialMutex(); void giveSerialMutex();
SemaphoreHandle_t serialMutex; SemaphoreHandle_t serialMutex;
bool beginUpdate(size_t size); bool beginUpdate(size_t size);
bool beginUpdate(size_t size, uint16_t baudRate); bool beginUpdate(size_t size, uint32_t baudRate);
bool writeUpdate(uint8_t* data, size_t size); bool writeUpdate(uint8_t* data, size_t size);
void endUpdate(); void endUpdate();
size_t getUpdateBytesWritten(); size_t getUpdateBytesWritten();
protected: protected:
uint16_t baudRate; uint32_t baudRate;
uint16_t uploadBaudRate; uint32_t uploadBaudRate;
uint8_t txPin; uint8_t txPin;
uint8_t rxPin; uint8_t rxPin;
size_t otaBytesWritten; size_t otaBytesWritten;

View File

@ -608,6 +608,7 @@ void InternalDisplay::refreshPWMAdjustmentId()
this->displayAdapter->print(pmwAdjustmentPin); this->displayAdapter->print(pmwAdjustmentPin);
this->displayAdapter->print("\""); this->displayAdapter->print("\"");
this->sendStopBytes(); this->sendStopBytes();
this->giveSerialMutex();
} }
/** /**