Skip to content

Add MarkWTech extra buttons and dual-slot HTTP firmware OTA - #3

Open
keskad wants to merge 7 commits into
mainfrom
feat/markwtech-extra-buttons
Open

Add MarkWTech extra buttons and dual-slot HTTP firmware OTA#3
keskad wants to merge 7 commits into
mainfrom
feat/markwtech-extra-buttons

Conversation

@keskad

@keskad keskad commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Why this is one PR

MarkWTech hardware bring-up and dual-slot firmware OTA are the same initiative. Extra GPIO buttons, pin remaps, and the DevKit wiring guide exist so the throttle can be assembled and driven. HTTP OTA is how firmware is iterated while that hardware is being built (no USB cable on every change) and is also the intended production update path once the dual-slot table is on the chip.

Companion: wireless-programmer#2 (update-firmware --mode ap|lan|usb).

MarkWTech extra buttons and wiring

  • Five debounced GPIO tact switches: menu left, Stop, menu right, Back, Menu. Scanner in extra_buttons, mapped through MarkwtechSurface / MarkwtechNav (Back = Cancel; left/right page lists or move the cursor in text entry). Provisioning chord remains * + Stop (8 s).

  • Pins that actually exist on the ESP32-C6-WROOM-1 / DevKitC-1 headers (GPIO 14 is not broken out; GPIO 16 is UART0 TX):

    Button GPIO Header
    Menu left 11 J1-11
    Stop 12 (USB_D−) J3-14
    Menu right 4 J1-3
    Back 5 J1-4
    Menu 15 J3-4
  • Native USB is sacrificed only on D− (Stop). Firmware is flashed on the UART Type-C. GPIO 4/5/15 are strapping pins but idle-high with pull-up does not change boot mode if those buttons are not held at reset.

  • Hardware guide (docs/hardware/markwtech.md): per-component tables, master GPIO map, J1/J3 positions, and the battery hardware the DevKit lacks vs the original LOLIN32 WiTcontroller (TP4056, S7V8F3 3.3 V, 47 kΩ/47 kΩ divider on GPIO 1).

Dual-slot HTTP firmware OTA

First flash of the new table is USB (espflash / wireless-programmer update-firmware --mode usb with ELF + partitions.csv). After that, updates are HTTP:

nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000
ota_0, app, ota_0, 0x10000, 0x3C0000
ota_1, app, ota_1, 0x3D0000, 0x3C0000

NVS stays at 0x9000. No factory partition. Slot size 0x3C0000; NET_SOCKETS=6 / PROG_NET_SOCKETS=4.

Two HTTP paths, same POST /api/v1/firmware (streamed, magic 0xE9, chip id 0x000D / ESP32-C6). Body is .app.bin (espflash save-image without --merge); merged dumps are rejected.

  1. Soft-AP (8 s chord) — DHCP 192.168.0.50–200, HTTP at 192.168.0.1. After OTA the throttle stays in programming_mode. heiko-wifred: AP chord only (no Extras menu).
  2. STA / layout Wi-Fi — Extras → Firmware update enables HTTP on the layout IP and advertises mDNS _longfred-ota._tcp. Leaving the screen disables it. STA HTTP is firmware + GET settings/page only (no PUT settings, no programming-mode/off). After OTA the throttle reboots onto layout Wi-Fi.

Flash writes take a mutex. CI publishes .app.bin artifacts; size-check covers the new slot.

Test plan

  • make build VARIANT=markwtech
  • make build VARIANT=longfred-standard
  • On hardware: left/right page lists, Back cancels, Menu opens menu, Stop is EStop
  • On hardware: * + Stop for 8 s enters provisioning
  • USB first install: update-firmware --mode usb with ELF + partitions.csv
  • Soft-AP OTA: chord, then update-firmware --mode ap --file *.app.bin
  • LAN OTA: Extras → Firmware update, then scan --mode lan / update-firmware --mode lan --host <ipv4> --file *.app.bin

keskad and others added 6 commits August 13, 2026 08:20
Wire left/Stop/right/Back/Menu on GPIO 11–14 and 16 with a debounced scanner, map them through MarkwtechSurface/NavProfile, and document the pinout so provisioning chord *+Stop works on hardware.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep GPIO 16 free for the serial console; GPIO 15 is strapping but idle-high with pull-up is safe if Menu is not held at reset.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add per-component connection tables, a master GPIO map, and clarify GPIO 15 strapping behavior on stock DevKitC-1 boards.

Co-authored-by: Cursor <cursoragent@cursor.com>
GPIO 14 is not broken out on the ESP32-C6-WROOM-1 module, so the Back
button had no header to connect to. Move it to GPIO 5 and Menu-right
from USB_D+ (13) to GPIO 4, keeping the native USB pair intact apart
from Stop on USB_D-.

Document the ESP32-C6-DevKitC-1 J1/J3 header positions for every wire,
and add the battery hardware the DevKit lacks compared to the LOLIN32
the original WiTcontroller uses: charger, 3.3 V regulator and the
47k/47k divider feeding the ADC on GPIO 1.

Co-authored-by: Cursor <cursoragent@cursor.com>
Serve POST /api/v1/firmware from the pairing AP (with DHCP) and from the
Extras firmware-update screen on STA, writing the inactive OTA slot.

Co-authored-by: Cursor <cursoragent@cursor.com>
Point the first dual-slot install at update-firmware --mode usb as well as
a raw espflash invocation.

Co-authored-by: Cursor <cursoragent@cursor.com>
@keskad keskad changed the title Add MarkWTech extra GPIO tact buttons Add MarkWTech extra buttons and dual-slot HTTP firmware OTA Aug 15, 2026
Add an English step-by-step build plus a Polish translation, log a
suggested ADC factor for first-power calibration, and enable 4-minute
inactivity sleep with a 5% low-battery cutoff.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant