V1 Unpatched Switch ESP32-S3 payload injector

  • Thread starter Thread starter AmeliaFox
  • Start date Start date
  • Views Views 8,910
  • Replies Replies 88
  • Likes Likes 9
OK that's good so now we know what the issue is and we can narrow it down even further.

1: Either you have a wrong USB library installed or you need to update your boards.

First check you have this boards file installed - if not make sure you do.
View attachment 587616
i had 3.3.11. uninstalled and now have 3.3.7 installed. build and upload firmware again?
 
ok, so that didnt work but i noticed that it must have injected something because switch is still black screen but when i plug it in to my pc and check tegrarcmgui, it doesnt show connected in RCM Mode.

the file with 3.3.7 boards is 1612KB
the file with 3.3.11 boards was 1616KB
 
ok, so that didnt work but i noticed that it must have injected something because switch is still black screen but when i plug it in to my pc and check tegrarcmgui, it doesnt show connected in RCM Mode.

the file with 3.3.7 boards is 1612KB
the file with 3.3.11 boards was 1616KB
Reboot the switch and put it into RCM mode again and try injection again, sometimes the switch does that. Arduino is also a bit strange and doesn't delete cached files properly sometimes so close Arduino and remove all the folders in the sketches folder, then rebuild and flash the waveshare again.
 
  • Love
Reactions: impeeza
Reboot the switch and put it into RCM mode again and try injection again, sometimes the switch does that. Arduino is also a bit strange and doesn't delete cached files properly sometimes so close Arduino and remove all the folders in the sketches folder, then rebuild and flash the waveshare again.
it did the same thing again

edit:
checked the system information after that attempt and i see this:
1787628847389.png


edit2:
my bad on this, i built with PSRAM disabled this time. rebuilding now
 
Last edited by mcPickleRick,
it did the same thing again
OK, then what we need to do next is look at the sketch - at the top you'll see all the include files - these are the libraries we are using, so go through those and tell me what versions you have installed and then I'll compare with the ones I have installed. For example -
<ArduinoJson.h> I have 7.4.2
<ESPAsyncWebServer.h> - I have 3.10.0

Do that for all the libs we are using (ignore the ones that come pre-packaged in the src folder). I am going to my bed now, but if you make a list I will check them when I get up and see what you have different.
 
OK, then what we need to do next is look at the sketch - at the top you'll see all the include files - these are the libraries we are using, so go through those and tell me what versions you have installed and then I'll compare with the ones I have installed. For example -
<ArduinoJson.h> I have 7.4.2
<ESPAsyncWebServer.h> - I have 3.10.0

Do that for all the libs we are using (ignore the ones that come pre-packaged in the src folder). I am going to my bed now, but if you make a list I will check them when I get up and see what you have different.
looks like the issue was with the boards version. i updated the firmware again after build with PSRAM on and it works now. appreciate all the time you spent helping me work through this!
 
yup, ill do some more testing tomorrow with a full compile and flash with the 3.3.7 boards version to see if it works straight that way
It will work fine now, the bootloader comes with the boards file and we know that one works, the firmware file works and lastly the partitions is built when we compile so that's not an issue. If you have it working now, build for your other chips. Make sure to change boards definitions for the waveshare mini to - waveshare esp32-s3-zero or it won't work. Also I think the PSRAM is octal for that rather than quad, so you should make sure to test that when you select that you pick the one starting with O.
 
Last edited by snuffbot1,
It will work fine now, the bootloader comes with the boards file and we know that one works, the firmware file works and lastly the partitions is built when we compile so that's not an issue. If tou have it working now, build for your other chips. Make sure to change boards definitions for the waveshare mini to - wavesahre esp32-s3-zero or it won't work. Also I think the PSRAM is octal for that rather than quad, so you should make sure to test that when you select that you pick the one starting with Q.
i just updated the firmware for the waveshare tiny. i used the esp32s3 dev module as the board and the custom partitions.csv for the 8MB flash, PSRAM set to OPI PSRAM and it is working as well now!
 
i just updated the firmware for the waveshare tiny. i used the esp32s3 dev module as the board and the custom partitions.csv for the 8MB flash, PSRAM set to OPI PSRAM and it is working as well now!
Great, now I can sleep in peace. Well done, you got there in the end.
:)
Post automatically merged:

@mcPickleRick

I've attached a couple of files to show you how to code the buttons/touchscreen and show battery information for the waveshare 1.8 v1 touch. These can be used to help you create a UI for it and put in into standby/swap payloads etc from from touchscreen.

I can't post the dongle files with the touch/button code included as it doesn't belong to me and I don't want to piss mrdude off, but the code attached can be used to help you as I made it myself. You can give the code to AI and ask it to implement it into the dongle code and it should do it very quickly if you don't know how to code yourself. You should download and install the waveshare examples from waveshare site and put in your arduino folder so you have the correct libraries.
 

Attachments

Last edited by snuffbot1,
Great, now I can sleep in peace. Well done, you got there in the end.
:)
Post automatically merged:

@mcPickleRick

I've attached a couple of files to show you how to code the buttons/touchscreen and show battery information for the waveshare 1.8 v1 touch. These can be used to help you create a UI for it and put in into standby/swap payloads etc from from touchscreen.

I can't post the dongle files with the touch/button code included as it doesn't belong to me and I don't want to piss mrdude off, but the code attached can be used to help you as I made it myself. You can give the code to AI and ask it to implement it into the dongle code and it should do it very quickly if you don't know how to code yourself. You should download and install the waveshare examples from waveshare site and put in your arduino folder so you have the correct libraries.
this is great, thanks again! i have some python and javascript experience but have never worked with arduino and these types of boards. im able to make sense of some of the code but ill have to spend some time with AI to explain some of the parts i dont understand. ill look at these and see if i can throw something together. would love to have some kind of grid selection screen which shows the payloads and then injects the one that is selected. either way, this is an awesome project...kudos to the creator and to you and @Shalasere for the support. i feel like i wasted your time helping me debug and it turned out to be a board version issue (not sure why that would cause this) but i guess its tracked here so if others run into the issue they will know how to solve it :)
Post automatically merged:

I also plan on doing an internal install, so if anyone has done so i would love to hear what your experience was like. i did some tracing on the waveshare tiny n8r8 and found a potentially easier spot to solder the d+ and d- points.
ill attempt to install to the ends of the smd components there and see how it goes
 

Attachments

  • Tiny N8R8 USB Data Points 2.png
    Tiny N8R8 USB Data Points 2.png
    7.8 MB · Views: 1
Last edited by mcPickleRick,
  • Like
Reactions: impeeza
this is great, thanks again! i have some python and javascript experience but have never worked with arduino and these types of boards. im able to make sense of some of the code but ill have to spend some time with AI to explain some of the parts i dont understand. ill look at these and see if i can throw something together. would love to have some kind of grid selection screen which shows the payloads and then injects the one that is selected. either way, this is an awesome project...kudos to the creator and to you and @Shalasere for the support. i feel like i wasted your time helping me debug and it turned out to be a board version issue (not sure why that would cause this) but i guess its tracked here so if others run into the issue they will know how to solve it :)
Post automatically merged:

I also plan on doing an internal install, so if anyone has done so i would love to hear what your experience was like. i did some tracing on the waveshare tiny n8r8 and found a potentially easier spot to solder the d+ and d- points.
ill attempt to install to the ends of the smd components there and see how it goes
On the waveshare tiny just look at the first few posts of this thread, you can buy a breakout board that plugs into the ribbon cable, they are cheap as anything from Ali express, so are the ribbon cables. This would make an install far easier. For UI coding there's a free program called Squareline Studio you can use and there's loads of tutorials on youtube. There's a youtube channel called VolosProjects and you can see lot's of examples on UI coding for lcd/touchscreens for esp based boards.

Grid selection screen will be easy, it's just a loop that scrolls the contents of a dir and prints out a list. There's an example mp3 player code that's basically the same, but instead of selecting a file ending mp3, you are selecting a file called bin - it's on waveshare github example's page, that should help you. The examples I posted should just compile as is and you can get a basic gist of how the code works and what headers you will need.

Anyway, good luck on your coding. Also if you had to give this project a mark out of 10 and the Android App it comes with, what would you rate it as? And if you could improve it what would you add or do differently? (bare in mind the code posted is for waveshare mini with 4mb flash).
 
  • Love
Reactions: impeeza
On the waveshare tiny just look at the first few posts of this thread, you can buy a breakout board that plugs into the ribbon cable, they are cheap as anything from Ali express, so are the ribbon cables. This would make an install far easier. For UI coding there's a free program called Squareline Studio you can use and there's loads of tutorials on youtube. There's a youtube channel called VolosProjects and you can see lot's of examples on UI coding for lcd/touchscreens for esp based boards.

Grid selection screen will be easy, it's just a loop that scrolls the contents of a dir and prints out a list. There's an example mp3 player code that's basically the same, but instead of selecting a file ending mp3, you are selecting a file called bin - it's on waveshare github example's page, that should help you. The examples I posted should just compile as is and you can get a basic gist of how the code works and what headers you will need.

Anyway, good luck on your coding. Also if you had to give this project a mark out of 10 and the Android App it comes with, what would you rate it as? And if you could improve it what would you add or do differently? (bare in mind the code posted is for waveshare mini with 4mb flash).
thanks for all the resources, ill check them out. if i had to rate this (i havent used the android app), id give it a 9 for the ease of setup and web features. what i would improve is the consistency of the header and the navigation menus (different pages have different navigation options and the fact that the header is for navigation is not clear. also sometimes the home button is on the right in the header (on the full page screens) and sometimes its not there at all (on the mobile looking screens). also when you go to file editor, only one file is editable at the root. only one file shows at the root level:
1787711473061.png

1787711487433.png

one other minor thing i noticed is mDNS is misspelled on the configuration screen:
1787711883861.png

last thing is that while doing a firmware update from the web interface when we were debugging yesterday, the board went to sleep during one of my updates and it failed. should probably disable/pause the sleep timer while certain actions are being taken.
of course these are mostly minor things and dont take away from the features provided. overall, excellent product that could use some polishing in the UI.
i do have one issue with the amoled, when it sleeps it doesnt wake back up from the power button. have to hold to power off and then turn it back on. do you have that same issue?
 
  • Like
Reactions: snuffbot1
@mcPickleRick

Good Spot on that MNDS, I didn't notice that before, I've attached the fixed config page header. The firmware update going to sleep thing should be fixed by editing this function.

Code:
void handleFlashRequest(AsyncWebServerRequest* request) {
    autosleep = false; //don't go to sleep when flashing....
    request->send(200, "text/plain", "Flashing now...");
}

The thing about the amoled you mention is not an issue for this firmware because it's not designed for that board, it's specifically made for waveshare mini with 4MB flash or just generic esp32s2/s3 boards without screens. Amoled has it's own non public code base, you'll need to modify the code with some of the code from the examples I posted. The wake up on the mini is via a touch gpio pin, so you just need to alter the code to use that. If you are going to fit the mini inside your switch I strongly suggest you get a touch sensor and wire up as the instructions suggest so you can wake up the chip and reset it if you need to.

The file editor is designed that way to only allow editing specific files with the following extensions - const char* ALLOWED_EXTENSIONS[] PROGMEM = { "txt", "html", "js", "mjs", "css", "cache" };
This is the reason it's not showing other files, you can edit the code to allow more extensions and also the editor_gz file (unpack and convert the array back to html). So basically that's a feature and not a bug. it's done like that on purpose because the file needs to fit in the 2MB psram (so we don't want to edit too large files) as that's where it's edited and saved before it gets written back to flash.

I think the header bars on each page is designed the way it is for a reason, as some have buttons and stuff and it was the only way to fit things on the screen, I am not a graphics guru or css/html/javascript expert so maybe you can redesign the layout and post the modified html/css files? I'll let mrdude know though so he is aware, or he probably will read this as he's on this forum from time to time.
 

Attachments

Last edited by snuffbot1,
@mcPickleRick

Good Spot on that MNDS, I didn't notice that before, I've attached the fixed config page header. The firmware update going to sleep thing should be fixed by editing this function.

Code:
void handleFlashRequest(AsyncWebServerRequest* request) {
    autosleep = false; //don't go to sleep when flashing....
    request->send(200, "text/plain", "Flashing now...");
}

The thing about the amoled you mention is not an issue for this firmware because it's not designed for that board, it's specifically made for waveshare mini with 4MB flash or just generic esp32s2/s3 boards without screens. Amoled has it's own non public code base, you'll need to modify the code with some of the code from the examples I posted. The wake up on the mini is via a touch gpio pin, so you just need to alter the code to use that. If you are going to fit the mini inside your switch I strongly suggest you get a touch sensor and wire up as the instructions suggest so you can wake up the chip and reset it if you need to.

The file editor is designed that way to only allow editing specific files with the following extensions - const char* ALLOWED_EXTENSIONS[] PROGMEM = { "txt", "html", "js", "mjs", "css", "cache" };
This is the reason it's not showing other files, you can edit the code to allow more extensions and also the editor_gz file (unpack and convert the array back to html). So basically that's a feature and not a bug. it's done like that on purpose because the file needs to fit in the 2MB psram (so we don't want to edit too large files) as that's where it's edited and saved before it gets written back to flash.

I think the header bars on each page is designed the way it is for a reason, as some have buttons and stuff and it was the only way to fit things on the screen, I am not a graphics guru or css/html/javascript expert so maybe you can redesign the layout and post the modified html/css files? I'll let mrdude know though so he is aware, or he probably will read this as he's on this forum from time to time.
got it, thanks for the detailed explanation! ill start digging into the code examples for the amoled and see if i can make something specific for that. what are you using to turn the html files into the .h files? i was able to create a couple of scripts but not sure if there is a simpler way. thanks for the updated config file, im gonna try to modify on my own before i use it so i can boost my coding skills a little!
 
got it, thanks for the detailed explanation! ill start digging into the code examples for the amoled and see if i can make something specific for that. what are you using to turn the html files into the .h files? i was able to create a couple of scripts but not sure if there is a simpler way. thanks for the updated config file, im gonna try to modify on my own before i use it so i can boost my coding skills a little!
MrDude gave me a program he made to convert them automatically, the program basically does this - Compresses html to tar.gz then converts the tar.gz into a byte array. To convert the h file back into the html you can do this:

Open the h file in an editor and remove all the blank space and ", 0x" so you are just left with the actual bytes like 1f 8b ... If you copy those into hxd as a new file then you can save it as x.tar.gz. Then you can use 7zip to unpack it and you'll have the html file. The html file contains the css/javascript/html code which calls the functions in the Arduino file.
 
  • Love
Reactions: impeeza
MrDude gave me a program he made to convert them automatically, the program basically does this - Compresses html to tar.gz then converts the tar.gz into a byte array. To convert the h file back into the html you can do this:

Open the h file in an editor and remove all the blank space and ", 0x" so you are just left with the actual bytes like 1f 8b ... If you copy those into hxd as a new file then you can save it as x.tar.gz. Then you can use 7zip to unpack it and you'll have the html file. The html file contains the css/javascript/html code which calls the functions in the Arduino file.
tried following those instructions but the tar.gz files come out corrupt. also tried saving as html and its all messed up. the script i have turns the bytes into a valid readable html file (at least for the ones i tried so far like editor, config and index). is the next step to zip with gzip and turn that back into bytes and update the .h files? i think that should work
Post automatically merged:

ok so i tested that and it doesnt work. i get the following error in the browser console when i go to the config page:
Failed to load resource: net::ERR_CONTENT_DECODING_FAILED

im converting html straight to gz...maybe this is not the right way

i was able to turn the bytes into hex and output the config.tar.gz but when i extract it i get a config.tar which fails to extract but i can change the extension to html and it has valid html in it (which i was already able to get with my script). now just need to figure out how to turn it back into a working .h file. i noticed when i compress my html file with gzip and turn that back into bytes it is a couple hundred lines longer than the original even though the only change was swapping the N and the D (so i assume the size shouldnt change)
 
Last edited by mcPickleRick,
  • Wow
Reactions: impeeza
tried following those instructions but the tar.gz files come out corrupt. also tried saving as html and its all messed up. the script i have turns the bytes into a valid readable html file (at least for the ones i tried so far like editor, config and index). is the next step to zip with gzip and turn that back into bytes and update the .h files? i think that should work
Post automatically merged:

ok so i tested that and it doesnt work. i get the following error in the browser console when i go to the config page:
Failed to load resource: net::ERR_CONTENT_DECODING_FAILED

im converting html straight to gz...maybe this is not the right way

i was able to turn the bytes into hex and output the config.tar.gz but when i extract it i get a config.tar which fails to extract but i can change the extension to html and it has valid html in it (which i was already able to get with my script). now just need to figure out how to turn it back into a working .h file. i noticed when i compress my html file with gzip and turn that back into bytes it is a couple hundred lines longer than the original even though the only change was swapping the N and the D (so i assume the size shouldnt change)
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.
 

Site & Scene News

Popular threads in this forum