From 0bd5de54ec3a2b07df3371934db9e2bfb953f7f7 Mon Sep 17 00:00:00 2001
From: dx <dequis@dequis.org>
Date: Sat, 25 Nov 2023 20:53:49 +0000
Subject: [PATCH] docs: "updating firmware" section

---
 docs/badge/firmware.rst          |  8 ++---
 docs/badge/updating_firmware.rst | 55 ++++++++++++++++++++++++++++++++
 docs/index.rst                   |  1 +
 3 files changed, 58 insertions(+), 6 deletions(-)
 create mode 100644 docs/badge/updating_firmware.rst

diff --git a/docs/badge/firmware.rst b/docs/badge/firmware.rst
index 058e99adec..7f6d8ad1c5 100644
--- a/docs/badge/firmware.rst
+++ b/docs/badge/firmware.rst
@@ -75,7 +75,7 @@ This is the SPI flash partition layout we use:
 | ``vfs``      | 12MiB  | FAT32 filesystem (with [#WL]_ layer). |
 +--------------+--------+---------------------------------------+
 
-
+.. [#WL] Wear leveling, to protect internal flash from death by repeat sector write.
 
 Accessing files from a PC
 -------------------------
@@ -203,11 +203,7 @@ Instructions on how to run ``esptool.py`` are given with every firmware update r
 Updating Firmware
 -----------------
 
-Download a `release <https://git.flow3r.garden/flow3r/flow3r-firmware/-/releases>`_, extract the tarball and follow instructions in the README. There will be notes on how to perform updates through either :ref:`Disk Mode`, `Recovery Mode`_ or through a low-level flash_.
-
-Or, if you're at CCCamp2023, visit our firmware update station, once it is availble.
-
-.. [#WL] Wear leveling, to protect internal flash from death by repeat sector write.
+(Moved to :ref:`its own section <updating_firmware>`)
 
 Versioning
 ----------
diff --git a/docs/badge/updating_firmware.rst b/docs/badge/updating_firmware.rst
new file mode 100644
index 0000000000..91d4fc6ec2
--- /dev/null
+++ b/docs/badge/updating_firmware.rst
@@ -0,0 +1,55 @@
+.. include:: <isonum.txt>
+.. _updating_firmware:
+
+Updating firmware
+=================
+
+Update via webflash
+-------------------
+
+If you have a web browser which supports WebSerial, you can connect your badge
+to your computer then navigate to:
+
+https://flow3r.garden/flasher/
+
+Update via updat3r
+------------------
+
+Since firmware v1.3.0, there is a built-in wifi updater.
+
+Ensure wifi is connected, and then go to Settings |rarr| Check For Updates and
+follow the instructions.
+
+Update via USB mass storage
+---------------------------
+
+Put your badge into SD Card Disk Mode: either by selecting 'Disk Mode (SD)'
+from the badge's System menu, or by rebooting into Recovery Mode (by holding
+down the right trigger) and selecting 'Disk Mode (SD)' from there.
+
+Now, with the badge connected to a computer, you should see a USB Mass Storage
+('pendrive') appear. Copy flow3r.bin from the release there.
+
+Then, stop disk mode, and from the Recovery Mode (boot the badge with the right
+trigger pushed down), select 'Flash Firmware Image', then flow3r.bin.
+
+Update using esptool.py
+-----------------------
+
+You can also fully flash the badge from the commandline. To do that, start the
+badge in bootloader mode (this is different from recovery mode!) by holding
+down the left trigger while powering it up.
+
+Extract the .bin files from a release tarball, and run esptool.py with the
+following arguments:
+
+::
+
+    esptool.py -p /dev/ttyACM0 -b 460800 \
+        --before default_reset --after no_reset --chip esp32s3 \
+        write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m \
+        0x0 bootloader.bin \
+        0x8000 partition-table.bin \
+        0x10000 recovery.bin \
+        0x90000 flow3r.bin \
+        -e
diff --git a/docs/index.rst b/docs/index.rst
index c33ab1c21e..982657e159 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -26,6 +26,7 @@ User manual
    badge/assembly.rst
    badge/mods.rst
    badge/usage.rst
+   badge/updating_firmware.rst
 
 .. toctree::
    :maxdepth: 1
-- 
GitLab