Do the "button dance" - hold the Arduino in reset, releasing just you see the download start in the IDE. This may (will!) take a little practice to get just the right timing.
Use an external programmer connected to the ICSP connector. This could be a commercially made one, a DIY, or another Uno programmed and connected as an ICSP programmer. How-to's ...
The key here is to remember the simple rules:
One device can send to many devices
One device can receive only from one device
In your situation you have three devices that are communicating:
The USB to UART chip
The on-board ATMega, and
The off-board ATMega connected to the TX/RX pins.
All three of those are connected together through the TX and RX pins. ...
Use the SWD interface and a programmer to burn the bootloader to SAMD.
source of the picture https://firstname.lastname@example.org/arduino-in-circuit-debugging-with-platformio-9f699da57ddc
I had luck with Adafruit DAP library using an Arduino M0 to burn a bootloader to MKR Zero.
This is actually somewhat more tricky than you would at first thing.
First off, the "shock sensor" is merely a spring inside a tube. This will create lots of triggers while it's being "shocked", which really is messy.
Secondly, you only want those shocks to make it through to the ESP when you are in deep sleep.
Thirdly, you don't want whatever you ...