Super Wifi Duck Pad
- 7 Devlogs
- 19 Total hours
A macropad with a wifi portal!
A macropad with a wifi portal!
I integrated the NeoPixel LED with the firmware. My only problem was that the NeoPixel library was vendored in. I fixed that by adding a PlatformIO library in the config. Now you can show the status of your script through the LED! It also shows you if it managed to connect to WiFi. I tried to make the ip address of the device static while in station mode, but it turns out things like that vary between routers, so I just added a readout of the ip address to the settings. I made a demo video for the LED. The three flashes at the beginning confirm that it connected to a wifi network. I had to put tape over the LED to diffuse it.
I made it so that you did not need to connect to the access point to configure the device. This is handy because otherwise you would have to disconnect from the internet to configure the device. I also fixed a stubborn bug with the profiles. The problem was that the get_profile command returned the current profile with a newline. This in turn broke the javascript that let you edit the scripts. Instead of editing 6 (for button six) it was editing \n\r6. This broke the quotes and made a big mess.
This is a really long devlog because profiles are a big feature. They make it so that you do not have to overwrite your macros every time you switch contexts. They were tricky to make for a variety of reasons. I had to add multiple cli commands so that the web ui could do things, refactor lots of things so that they could be reused, and change how I compiled the project. I also had to write frontend code! shudder I learnt a lot of things about the project while debugging. For example, a cli command called from the websocket must return something or the ui will hang. Fun times! Here is the diff of what I did: link
I made so that the ordering made more sense. It used to start with zero which is fine but confusing for some people. I also made so that the pins are read in the right order, as the order used to be
1 4 7
2 5 8
3 6 9
to make it easier to route, but that also is confusing, so now it reflects the ui. The next step is shortcut profiles like the og duckyPad.
I made it so that the script selector is like the buttons so that it is easier to use. It took a while because I am not very good at frontend things, but I like how it turned out. It was made especially tricky as on-device debugging involves compiling and uploading the new firmware, connecting to the access point network, and then reloading. I did get a debug setup going with python -m http.server but then the websockets did not work for obvious reasons.
This devlog is rather long, but a lot of things needed to happen before I wanted to make another devlog. I had a very difficult bug involving macros (written in DuckyScript) running at the same time. It wasn’t always a problem, but the buttons made it really easy to crash the system by overlapping scripts. When I added some code to keep track of that, it would crash when launching a script from the web-ui, but not when launching them from the terminal or buttons. After much (much much much) debugging and banging my head against walls, I figured that the problem was with a websocket status pulse. By delaying the pulse, I could avoid a crash. You can see the one line javascript patch below. I’m not sure why it was crashing the device, but it seems to be fixed now. I made a PR to upstream here Anyway, enjoy the demo!
I made a macropad with KiCad. It uses an esp32 s3, so it will have a web based config editor. This project is the firmware for it as I did not know that stardance could do hardware projects. Since I just worked on some button code and got set up, I will just have some pics of the macropad.