suchmememanyskill / CYD-Klipper

An implementation of a wireless Klipper status display on an ESP32 + screen
https://suchmememanyskill.github.io/CYD-Klipper/
GNU General Public License v3.0
207 stars 26 forks source link

Serial console #115

Open bwucke opened 2 weeks ago

bwucke commented 2 weeks ago

After being prompted to enter the API key for the 4th time on a screen that simply refuses to calibrate correctly and won't allow me to request re-calibration without first entering the correct API key (long story why, not relevant here but you can ask out of curiosity), I thought enough is enough and I wrote a serial console for CYD-Klipper, to be able to change various settings - primarily stuff that when set wrong will make it difficult or impossible to fix through touchscreen.

serial

Example: Accidentally double-tap the first cross in calibration screen and you have to do a full wipe to get the screen to usable state; now connect to it with serial, type erase touch, reset and you'll be able to calibrate again. Or you've set screen brightness to zero, and can't see a thing, brightness 255 and we're back.

The console is simple bordering on primitive but it does what I wanted it to do, and adding commands is quick and easy.

The first version is here but I don't want to create a pull request yet as there are things that make it not as nice as it could be, and would require changes scattered all over the existing code instead of plugging 2 functions across 4 places as it is now. In particular assorted debugs spam the console making typing harder, and there are a couple approaches I'd like to discuss:

suchmememanyskill commented 1 week ago

Looks sick! Do you know if you can access this via the debug/terminal prompt of the web installer?

Also small sidenote, you can hold the boot button to clear touch calibration, and 0 brightness is not possible. Still cool nevertheless!

For hiding debug info: maybe you can enter a command to start logging debug info.

For displaying wifi password: why exactly is this needed?

bwucke commented 1 week ago

Do you know if you can access this via the debug/terminal prompt of the web installer?

Is there such a thing? I hope there is such a thing, I don't see a reason why not, and it would make configuring it after deploying totally easy.

For hiding debug info: maybe you can enter a command to start logging debug info.

Yeah, one could totally default to 'off' and require 'on' after every restart, not a problem. I'd just need to create a global variable (somewhere next to global_config but non-persistent) and swap every Serial.print??() that isn't from the console with a function or macro.

For displaying wifi password: why exactly is this needed?

Scenario: deployment of printer farm. Configure one printer. Make a bunch of clones of the SD card for rpi (so, same API key on all), do sets on CYD, copy the working settings, plug new CYD in, paste into terminal, there, configured.

Of course I could obscure it instead, and you'd have to paste into editor, and edit the right password in.

ps. erase key, erase ssid overwrite the secrets so if you're selling your printer/CYD to someone they won't get your private stuff.

Also if you have ideas for other commands I'm totally open.