aderusha / HASwitchPlate

LCD touchscreen for Home Automation
MIT License
727 stars 128 forks source link

Update buffers to support longer mqtt credentials #117

Closed kquinsland closed 3 years ago

kquinsland commented 3 years ago

In testing, I was unable to use the pre-compiled FW build as the password I chose for the MQTT client is longer than the pre-allocated 32 bytes.

The user and password fields for MQTT have no practical limits, so I settled on 128 bytes. If your MQTT username or password are more than 128 bytes in length, you'll probably have the skills needed to inspect the logs of your MQTT server and or the code to figure out that the user provided input is being silently truncated.

It will be several more hours before I can flash the firmware to my test device, but the code does compile and there seems to be plenty of room left:

Sketch uses 471964 bytes (45%) of program storage space. Maximum is 1044464 bytes.
Global variables use 40088 bytes (48%) of dynamic memory, leaving 41832 bytes for local variables. Maximum is 81920 bytes.
kquinsland commented 3 years ago

After testing, i found that the HTML fields are also character limited (makes sense.. i should have checked before hand...)

I think? i found a typo w/ the length of mqttServer and corrected that.

Firmware now accepts longer password and works w/ test MQTT server :).