So I should have been running this...
esptool.py --port /dev/tty.SLAB_USBtoUART --baud 115200 write_flash --flash_freq 80m --flash_mode qio --flash_size 32m 0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin 0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin
This got the board working again.
It still goes nuts and I have to re-flash when I run
wifi.save() and reboot.
I am not sure if this is a good idea or not, but I just removed the
wifi.save() and moved the wifi connect to the onInit function and it works on reboot. Is there something wrong with doing this?
Thanks for all of your help by the way!