V1 Unpatched Switch ESP32-S3 payload injector

  • Thread starter Thread starter AmeliaFox
  • Start date Start date
  • Views Views 9,630
  • Replies Replies 101
  • Likes Likes 9
Yes it will be bigger as the files are stripped and converted back to h using a custom minify version I got from mrdude that strips out all comments, spaces and stuff to make the file smaller before compressing and converting to the header file. Actually he made a few custom programs to automate everything. I don't know if he will want me to post them, I'm friends with him on a different website so I'll send him a message and ask but I don't know when he will reply as he's not online sometimes for quite a while.
that would be great if it could be shared :)

in the meantime, i was able to update the config page. i think i was doing the compression wrong initially. file size is better but still not as good as what you have (33KB vs 30KB) but i now have a path forward.

will play with this and see if i can make some UI changes and post back here

edit:
any idea what the Button GPIO Pin is used for?
1787750889573.png
 
Last edited by mcPickleRick,
that would be great if it could be shared :)

in the meantime, i was able to update the config page. i think i was doing the compression wrong initially. file size is better but still not as good as what you have (33KB vs 30KB) but i now have a path forward.

will play with this and see if i can make some UI changes and post back here
I've sent him a pm, so hopefully will hear back later today. Usually when he gives something he wants something back in return - so if you modify the pages themes or headers I expect he will want to see them. I am not just talking about changing some text or something, he will want something "different" or better than what he gave you/me.

I'm rubbish at website stuff so wouldn't know where to begin, I can just about draw a stickman on a bit of paper - that's my artistic limits. Being colour blind doesn't help either - blue and green just look the same to me, sometimes I think blue is grey. I get my wife to pick all the paint and stuff in the house.
 
  • Haha
Reactions: mcPickleRick
I've sent him a pm, so hopefully will hear back later today. Usually when he gives something he wants something back in return - so if you modify the pages themes or headers I expect he will want to see them. I am not just talking about changing some text or something, he will want something "different" or better than what he gave you/me.

I'm rubbish at website stuff so wouldn't know where to begin, I can just about draw a stickman on a bit of paper - that's my artistic limits. Being colour blind doesn't help either - blue and green just look the same to me, sometimes I think blue is grey. I get my wife to pick all the paint and stuff in the house.
im not very artistic either, my wife picks my clothes out and sets my clothes for me when we have any type of event :)
 
  • Like
Reactions: snuffbot1
edit:
any idea what the Button GPIO Pin is used for?
View attachment 587813
By default most esp boards have a button mapped to gpio 0, this is used to turn on and off the onboard addressable led on some boards. Long press for 5 seconds removes the config file and resets all the settings.

If you look at the button handler code it can have 3 states "single press", "double press", "long press". The touch gpio is for if you have a capacitive touch sensor to wake up/reset. RCM strap pin is if wiring an internal modchip you can use that pin for setting the switch into RCM mode automatically when the switch boots (you needs mosfet and a resistor if I recall for this - there's drawings showing how to do it).

You should try reading the code, it basically tells you what things do.

There's also an Android bluetooth app so you can change payloads from your phone if doing an internal install, so you should check that out.
 
Last edited by snuffbot1,
  • Like
Reactions: mcPickleRick
By default most esp boards have a button mapped to gpio 0, this is used to turn on and off the onboard addressable led on some boards. Long press for 5 seconds removes the config file and resets all the settings.

If you look at the button handler code it can have 3 states "single press", "double press", "long press". The touch gpio is for if you have a capacitive touch sensor to wake up/reset. RCM strap pin is if wiring an internal modchip you can use that pin for setting the switch into RCM mode automatically when the switch boots (you needs mosfet and a resistor if I recall for this - there's drawings showing how to do it).

You should try reading the code, it basically tells you what things do.

There's also an Android bluetooth app so you can change payloads from your phone if doing an internal install, so you should check that out.
yeah ive been digging into the code more, i think the touch and rcm ones are clear just wasnt sure about the button one. i will add some tooltips so there is additional info in the web interface
 
yeah ive been digging into the code more, i think the touch and rcm ones are clear just wasnt sure about the button one. i will add some tooltips so there is additional info in the web interface
OK good news for you, mrdude said i can give you the files. I gave him a keyen for a program he wanted in return.

Unizip this to the same directory as your ino file. So you should have a folder called helper in there now. Edit the html files in pages folder to your liking. Once done click on runme.bat and it will create the header files and automatically put them into the include folder once they are made.

I've include the source code for the compressor/convertor and minify. The binaries are build already so this is just incase you want to make sure there's no dodgy stuff going on. In the binaries folder is some text files. These are used for automatically replacing code in the minified files if minifier breaks anything. You should leave them as they are unless you added some code and it's not displaying properly after being minified.

I'll be expecting you to fix the headers and stuff to how you want and then post the results so we can all see how you expected the code to look :-). You should also check on a mobile phone and pc to make sure that everything works.
 

Attachments

Last edited by snuffbot1,
  • Love
Reactions: mcPickleRick
Yes it will be bigger as the files are stripped and converted back to h using a custom minify version I got from mrdude that strips out all comments, spaces and stuff to make the file smaller before compressing and converting to the header file. Actually he made a few custom programs to automate everything. I don't know if he will want me to post them, I'm friends with him on a different website so I'll send him a message and ask but I don't know when he will reply as he's not online sometimes for quite a while.
Please say to him. "Impeeza says hi"
 
OK good news for you, mrdude said i can give you the files. I gave him a keyen for a program he wanted in return.

Unizip this to the same directory as your ino file. So you should have a folder called helper in there now. Edit the html files in pages folder to your liking. Once done click on runme.bat and it will create the header files and automatically put them into the include folder once they are made.

I've include the source code for the compressor/convertor and minify. The binaries are build already so this is just incase you want to make sure there's no dodgy stuff going on. In the binaries folder is some text files. These are used for automatically replacing code in the minified files if minifier breaks anything. You should leave them as they are unless you added some code and it's not displaying properly after being minified.

I'll be expecting you to fix the headers and stuff to how you want and then post the results so we can all see how you expected the code to look :-). You should also check on a mobile phone and pc to make sure that everything works.
challenge accepted! thanks so much for this, making updates without this was very annoying. i do have a few tweaks i want to make along with the headers. i only have time to work on this in the evenings so it may be slow go but ill keep posting updates here

thanks again, much appreciated!
Post automatically merged:

first (minor) test update made! added an information icon next to the firmware version with the latest changes. also, there was another typo in the code and the config page. the LED is listed as WS212B when it is actually WS2812B. updated the config and the ino file to reflect this. will work on a few more updates tonight and see if i can make any meaningful changes:
1787797144903.png

Post automatically merged:

another minor update...display selected file name with a clear selection button next to it on the firmware update screen:
1787799628597.png
 
Last edited by mcPickleRick,
@mcPickleRick
Good spot on the ws2812b, I never noticed that either. I've also updated the code for that, I should probably put a check in to the tar installer to get the sleep state when uploading/installing tar files so that when doing that we temp stop sleep and then resume it once the tar is installed. I'll do that later while you are messing about with the webui.

I won't be working much on this code this week though as i just got a new esp32-c5 dev board and I'm making a matter over thread border gateway router with it and a web ui so I can input console commands, upgrade firmware and stuff like that.

EDIT: Here's the updated ino file with all recent fixes and logic added to disable/reset the timer when doing a firmware upload/update and uploading and installing tar files. I also added the other fixes for renamed ws2812b/cdc detection.

FYI on your amoled touch 1.8 I think the CS GPIO for the Micro SD card is GPIO 7, I don't have any spare cards to test with but if you install one format it to fat and when you check the information page it should show the flash size as the size as the micro sd card, so you can basically have a massive flash for storing payloads or a webserver. I have got css font face installed for PS4 in it's own folder so can use this for Switch and PS4.
 

Attachments

Last edited by snuffbot1,
@mcPickleRick
Good spot on the ws2812b, I never noticed that either. I've also updated the code for that, I should probably put a check in to the tar installer to get the sleep state when uploading/installing tar files so that when doing that we temp stop sleep and then resume it once the tar is installed. I'll do that later while you are messing about with the webui.

I won't be working much on this code this week though as i just got a new esp32-c5 dev board and I'm making a matter over thread border gateway router with it and a web ui so I can input console commands, upgrade firmware and stuff like that.

EDIT: Here's the udpdated ino file with all recent fixes and logic added to disable/reset the timer when doing a firmware upload/update and uploading and installing tar files. I also added the other fixes for renamed ws2812b/cdc detection.

FYI on your amoled touch 1.8 I think the CS GPIO for the Micro SD card is GPIO 7, I don't have any spare cards to test with but if you install one format it to fat and when you check the information page it should show the flash size as the size as the micro sd card, so you can basically have a massive flash for storing payloads or a webserver. I have got css font face installed for PS4 in it's own folder so can use this for Switch and PS4.
that sounds like a fun project, good luck! thanks for posting the fixes, ill merge them in with my updates once im ready to release them (messing with different header layouts). ill test the amoled sd card stuff once i get around to working on the screen code as well
 
that sounds like a fun project, good luck! thanks for posting the fixes, ill merge them in with my updates once im ready to release them (messing with different header layouts). ill test the amoled sd card stuff once i get around to working on the screen code as well
You don't need to test the sd card stuff, I tested it with an official Lolin s3 pro and it works great on gpio 10 for that board, you just need to test that it's GPIO 7 for your waveshare amoled.

@impeeza - I passed your message on, mrdude say's hi he hope's you're doing well, and something about woke people on here (which I won't mention but had a laugh at).
 
@snuffbot1 i made a change to the ino to the hardReset function as it doesnt work for the firmware update (i still had to press the reset button for the changes to take effect). i changed esp_deep_sleep(1) to ESP.restart() to do an actual restart and not a soft reset which is what the esp_deep_sleep(1) does i think (restarts the main function but doesnt restart the board). the soft reset works for the config page i believe.
i added a softReset function for use with the /reboot call so that i dont change the full functionality and changed the hardReset to /reboot-hard to be used for post firmware update and on the reboot buttons.

heres a preview of the ui updates (its been tedious lol). going to split the board information into its own page at some point:
firmware update screen
1787930349638.png

Home (Payload Manager) screen:
1787930416101.png
 
  • Love
Reactions: impeeza
@snuffbot1 i made a change to the ino to the hardReset function as it doesnt work for the firmware update (i still had to press the reset button for the changes to take effect). i changed esp_deep_sleep(1) to ESP.restart() to do an actual restart and not a soft reset which is what the esp_deep_sleep(1) does i think (restarts the main function but doesnt restart the board). the soft reset works for the config page i believe.
i added a softReset function for use with the /reboot call so that i dont change the full functionality and changed the hardReset to /reboot-hard to be used for post firmware update and on the reboot buttons.

heres a preview of the ui updates (its been tedious lol). going to split the board information into its own page at some point:
firmware update screen
View attachment 588113
Home (Payload Manager) screen:
View attachment 588114
I'll have a look at the web ui when you have completed working on it. When you do a firmware update you need to hard reboot the board by powering it down (not just a soft restart), or the new firmware won't take effect until you do that. I am aware of that already but I am glad you noticed. (FYI - esp_deep_sleep(1) only put's the device to sleep for 1 microsecond, it doesn't do a reset - so that's there for a reason).

What to do is each time you make a change, create an update text file with a list and then add the new change to it so we know all the changes you made. When you have completed all the changes then they will be reviewed and tested to check they don't break anything. As you will know from reading the code, this sofware is pretty complex with thousands of lines of code in the c++ and thousands more in the web pages so it takes a while to check everything. Thanks.

NOTE - you also need to check when you make changes to the UI that you test on a mobile phone + a computer. And if you make changes to the code that it still fits on a 4MB esp32-S3 using the supplied partitions file for 4MB boards (space is tight).
 
Last edited by snuffbot1,
I'll have a look at the web ui when you have completed working on it. When you do a firmware update you need to hard reboot the board by powering it down (not just a soft restart), or the new firmware won't take effect until you do that. I am aware of that already but I am glad you noticed.

What to do is each time you make a change, create an update text file with a list and then add the new change to it so we know all the changes you made. When you have completed all the changes then they will be reviewed and tested to check they don't break anything. As you will know from reading the code, this sofware is pretty complex with thousands of lines of code in the c++ and thousands more in the web pages so it takes a while to check everything. Thanks.

NOTE - you also need to check when you make changes to the UI that you test on a mobile phone + a computer. And if you make changes to the code that it still fits on a 4MB esp32-S3 using the supplied partitions file for 4MB boards (space is tight).
yeah im not so good at tracking updates:
1787932008119.png

i did test the reboot-hard functionality with a firmware update and it worked. before with the softreset the fw info and updates wouldnt reflect until i pressed the reset button. but with the hard reset, it reflected in the ui immediately.

i checked the mobile ui in my pc browser by simulating an iphone 14 pro max and it looks fine. how would i check if it will fit in the 4MB board? do i look at the actual firmware file that i use for flashing from the web ui? if so, that has only grown 6KB
 
  • Like
Reactions: impeeza
i did test the reboot-hard functionality with a firmware update and it worked. before with the softreset the fw info and updates wouldnt reflect until i pressed the reset button. but with the hard reset, it reflected in the ui immediately.

i checked the mobile ui in my pc browser by simulating an iphone 14 pro max and it looks fine. how would i check if it will fit in the 4MB board? do i look at the actual firmware file that i use for flashing from the web ui? if so, that has only grown 6KB
You should compile it for a 4MB board. It will still work on your board (but the flash will show less space).

I think you are confused about sleep functions, you should check this page - https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/sleep_modes.html

It will show you how they work, that code line to sleep for 1 micro second was added on purpose so that the esp32-s3 had time to do something else in the browser or something else (probably reset wifi and bluetooth), I can't remember of the top of my head but it wasn't just added for no reason.
 
Last edited by snuffbot1,
  • Like
Reactions: mcPickleRick

Site & Scene News

Popular threads in this forum