In the original Macross series, the SDF-1 doesn’t set out to fight anyone. It launches because an alien fleet is already on its way and there is no other choice. The ship is barely understood, its fold drive untested, its crew a mix of civilians and soldiers who never signed up for an interstellar war. They leave Earth with what they have, figure out the rest along the way, and somehow keep flying.
That’s roughly the spirit in which this project approaches Bluetooth gamepad support.

After Part 4, the drone flew. Tilt control — mapping the AtomS3’s accelerometer to roll and pitch — worked well enough to navigate a room. But holding a small board at a precise angle for minutes at a time is genuinely tiring. Fatigue tremors start showing up in the roll and pitch axes. After a few sessions the wrists were unhappy and the drone was responding to them more than to intent.
The obvious solution: a gamepad. The ESP32-S3 has a Bluetooth radio. Gamepads speak Bluetooth. The SDF-1 had a fold drive. Let’s fire it up and see where we end up.
The Fold Drive — BLE HID Host
The ESP32-S3 supports BLE — Bluetooth Low Energy. The Arduino ESP32 platform ships a BLE library (BLEDevice.h) that can act as a HID host: scan for devices advertising the HID service (UUID 0x1812), connect, subscribe to Input Report notifications, and read raw bytes. No extra lib_deps entry required — the library is already aboard.
The approach is deliberately simple. No gamepad abstraction layer, no universal report parser. Scan for HID, connect, log the raw bytes, figure out the format, map it to flight axes. Every controller does its own thing with HID reports, so the format has to be discovered per-device anyway.

Following the project’s discipline on dependencies, all of this lives in src/bt/ble_gamepad.cpp. Nothing outside that file ever sees a BLEDevice or a BLEClient. The rest of the firmware receives a GamepadAxes struct — normalised values in [−1, 1], fully decoded — and never knows whether they came from Bluetooth, a touchscreen, or a Zentradi battle pod.
The fold drive is spinning. Now we need somewhere to go.
Unexpected Destination — the iPega PG-9021S
In Macross, the first fold jump doesn’t go where anyone planned. The SDF-1 executes the fold and ends up near Pluto — not Earth orbit, not anywhere useful — with the entire civilian city of Macross dragged along for the ride. It is not the mission. But the ship is intact, the crew is alive, and they have no choice but to work with where they are.

The first controller in hand was an iPega PG-9021S — a telescoping gamepad designed for phones, with two analog sticks, a D-pad, four face buttons, and shoulder triggers. It supports multiple pairing modes triggered by different button combos at power-on.
The first attempt: HOME + X — Android Standard Gamepad mode. The controller connected, appeared in the BLE scan, handshaked — and then disconnected. Every time. The root cause, after some digging, was BLE bonding. Standard Gamepad mode requires a security handshake that the ESP32 Arduino BLE library doesn’t perform. Without it, the controller politely refuses to stay paired.
The second attempt: HOME + A. Connected. Stayed connected. Data flowing.
This is an undocumented mode added in a 2019 iPega firmware update, officially called “Direct Play.” Designed for mobile games that read touch input directly, bypassing Android’s controller API entirely. The name should have been a warning about the destination.
In HOME+A mode, the iPega does not present itself as a gamepad. It presents itself as a touchscreen.
Not Pluto. But intact. And flying.
Reverse-Engineering Zentradi Technology — the 17-Byte Report
The Zentradi’s technology was incomprehensible to humans at first contact. It took time, captured ships, and a lot of dangerous guesswork to figure out what any of it actually did. The understanding, when it came, was hard-won.

When the iPega connects in HOME+A mode, it advertises HID Usage Page 0x0D (Digitizer), Usage 0x04 (Touch Screen). Every input report is 17 bytes — four 4-byte contact blocks, followed by a 1-byte contact count. Exactly how a multi-touch phone screen reports fingers.
Each 4-byte contact block is little-endian bit-packed:
bit 0: Tip Switch (1 = finger touching)
bit 1: In Range
bits 2–3: padding
bits 4–7: Contact ID (always 0 — both sticks share it)
bits 8–19: X coordinate (0–1200)
bits 20–31: Y coordinate (0–2200, top = 0)
Extracting X and Y from bytes b[1], b[2], b[3]:
uint16_t X = b[1] | ((b[2] & 0x0F) << 8);
uint16_t Y = (b[2] >> 4) | (b[3] << 4);
The controller’s screen is portrait internally, held in landscape. Physical UP/DOWN maps to X (up = X increases); LEFT/RIGHT maps to Y (left = Y increases).
Both sticks report Contact ID 0 — there is no field to distinguish left from right. The solution: Y coordinate. Values below 1000 are the left stick area; 1000 and above are the right stick area. The virtual touchscreen was laid out with enough separation that this split is reliable.
Technology understood. Now it can be used.
Calibration — Learning to Aim
Hikaru Ichijo wasn’t a natural in a Valkyrie on day one. He logged hours in the simulator, then more hours in real combat, learning how the machine responded before he could trust it.

Calibration here was simpler: move each stick to its extremes and resting center while logging raw reports. The numbers that came out:
| Axis | Stick | Coordinate | Center | Range |
|---|---|---|---|---|
| Throttle | Left UP/DOWN | X | 523 | ±300 |
| Yaw | Left LEFT/RIGHT | Y | 500 | ±240 |
| Pitch | Right UP/DOWN | X | 533 | ±145 |
| Roll | Right LEFT/RIGHT | Y | 1650 | ±120 |
Each axis normalises to [−1, 1]: (coordinate − center) / range. The result then passes through the same dead zone, expo curve, and slew-rate limiter used by the tilt controller — so switching between control modes doesn’t change the feel of the drone.
Both drones run altitude-hold firmware. Center stick means maintain altitude; deflect to climb or descend; release and the drone hovers wherever it is. The critical detail: the moment the stick returns inside the dead band, throttle snaps immediately back to neutral (0x80). Leave a residual value and the drone keeps climbing forever. Get that snap-back right and altitude control feels natural.
The FAST Packs — Mapping the Buttons
The FAST Packs in Macross weren’t part of the original Valkyrie design. They were add-ons — extra weapon and propulsion modules bolted onto a frame that was never built to carry them. They worked because the engineers understood the underlying system well enough to extend it.
Buttons in HOME+A mode appear as additional touch contacts at fixed (x, y) positions. The iPega is emulating PUBG Mobile’s on-screen button layout — each physical button maps to a virtual finger tap on a specific point of the touchscreen. There is no HID button bitmask. Discovery was purely empirical: press one button at a time, log the 17-byte report, note the coordinates.
| Button | x | y | Drone command |
|---|---|---|---|
| A | 332 | 2044 | Arm + takeoff |
| B | 780 | 1281 | Land |
| X | 241 | 1270 | Emergency stop |
| Y | 818 | 2020 | 360° flip |
| D-pad UP | 723 | 544 | Headless mode toggle |
| D-pad DOWN | 352 | 562 | Calibrate gyro |
| D-pad LEFT | 534 | 379 | Toggle screen on/off |
| LT | 1173 | 416 | Lock motors |
| R1 | 578 | 2041 | Unlock motors |
Detection uses ±30 pixel tolerance on each coordinate. Contacts are checked against this table before the stick zone classifier, so a button press near a zone boundary doesn’t accidentally register as axis movement.

Nine buttons. Working. The FAST Packs are on.
A Battle Won, A War Lost — the L1/RT/L3/R3 Investigation
Not every engagement in Macross ends cleanly. There are missions where the Valkyrie comes back intact but the objective wasn’t fully achieved — where you did everything right and it still wasn’t enough, for reasons outside your control.

Four buttons — L1, RT, L3, R3 — never appeared in any log. No contact, no matter how hard or how long they were pressed.
The controller was opened. The switches under all four had cracked solder joints — a common failure on telescoping gamepads that get repeatedly flexed. All four were resoldered. The controller went back together.
Plugged into an Android phone running a gamepad test app, in Standard Gamepad mode (HOME+X): all four buttons registered immediately. Clean signals. The hardware was fixed.
Back on the AtomS3, in HOME+A mode, with both analog sticks held deflected to keep two contacts active: press L1. The contact count never reached three. No third contact appeared for L1, RT, L3, or R3, in any combination.
The explanation is in what Direct Play mode actually emulates. PUBG Mobile’s touchscreen UI was designed for a phone. It never had L1, RT, L3, or R3 — those concepts don’t exist in a mobile touch game. The iPega’s firmware never assigned those buttons a position on the virtual screen. The hardware repair was real and complete. The limitation is a protocol design decision made years ago for a different platform entirely.
“It registers in Android’s controller test” and “it generates a contact in this HID profile” are two different questions. This was a useful reminder that confirming something works in one context says nothing about whether it works in another. The battle with the solder joints was won. The war for those four buttons was already lost before the controller was even opened.
We fly with nine.
The Zentradi Main Fleet — 8BitDo
In Macross, the first Zentradi ships are manageable. A squadron here, a patrol fleet there. The SDF-1 fights them off, learns their patterns, adapts. Then the main fleet arrives. Seven million warships. Not a battle. A wall.

With the iPega working, a natural question arose: could a proper console-style gamepad work? On hand: an 8BitDo SF30 Pro, an 8BitDo Zero 2, an 8BitDo Ultimate 2C, and an Xbox One S. All marketed as Bluetooth controllers. None of them connected. Every BLE scan came back empty.
LightBlue, a Bluetooth scanner app on a phone, also saw nothing from these controllers. But Android’s native Bluetooth pairing screen found the 8BitDo Zero 2 and Ultimate 2C instantly — listed as “Pro Controller.”
That name was the answer. “Pro Controller” is Nintendo’s Switch Pro Controller. 8BitDo’s Switch-emulation mode — activated by X+Start or the model-specific equivalent — makes the controller advertise itself as one. Android finds it because Android’s Bluetooth stack supports Classic Bluetooth, known as BR/EDR. The Pro Controller protocol runs over BR/EDR.
The ESP32-S3 does not support BR/EDR. There is no Classic Bluetooth radio on the die. This isn’t a software configuration — it’s the chip itself. Espressif’s own datasheet confirms it. The Bluepad32 project’s FAQ states it plainly:
“Only BLE gamepads are supported on ESP32-S3, since BR/EDR is not supported… Controllers like Switch, Wii, DualSense, DualShock, etc. only talk BR/EDR.”
Every failed attempt was the correct outcome. Four controllers, many pairing modes, many attempts. All correct. No sequence, no library, no firmware trick changes this. It is the hardware. The only ESP32 variant with a dual-mode radio — BLE and BR/EDR together — is the original ESP32, not the S3, C3, C6, or H2 variants. The AtomS3 runs an S3.
Seven million warships. This one doesn’t get won today.
Do You Remember Love — What We Have
At the end of Macross, Earth is not what it was. The battle left marks that don’t erase. But Hikaru is alive. Misa is alive. The SDF-1 is battered but standing. And somewhere in the ruins, Minmay is still singing — because culture and music turned out to matter more than anyone expected, and the proof of that is that anyone is around to remember it.
The BLE gamepad mode works. The iPega PG-9021S in HOME+A mode — a touchscreen disguised as a gamepad, discovered by accident when the obvious path was blocked — gives full analog control of all four flight axes plus nine functional buttons. The flight feel matches the tilt controller for roll and pitch, with the ergonomic advantage of a real grip in your hands instead of a board held sideways.
Nine of thirteen buttons. Four will never come. SELECT and START are reserved by the controller’s firmware for mode-switching and never appear in any HID report. The iPega works with what it is, which is more than enough to fly.
8BitDo controllers cannot work on this hardware. The AtomS3’s ESP32-S3 simply does not have the radio they speak. That question has been asked thoroughly, answered conclusively, and put to rest.
The SDF-1 didn’t come home with everything it left with. But it came home. The drone flies. And somewhere out there, the universe is still very large.

Next: a second drone arrives, with a completely different protocol hidden inside — and it took a packet capture to find out what it actually spoke.
Enjoy — PopolonY2k


























