Skip to content

feat(buildlab_scout): add status LEDs and rotary encoder - #34

Open
BuildLabDIY wants to merge 3 commits into
Alohataiti:south_editionfrom
BuildLabDIY:feat/scout-leds-encoder
Open

BuildLabDIY wants to merge 3 commits into
Alohataiti:south_editionfrom
BuildLabDIY:feat/scout-leds-encoder

Conversation

@BuildLabDIY

Copy link
Copy Markdown

BuildLab Scout boards ship with six WS2812 LEDs on GPIO13 and a rotary encoder (A on GPIO5, B on GPIO4, push button on GPIO6). The buildlab_scout variant in this repo did not support either one. This PR adds them to the companion radio envs, for both the E22 and the E22P module.

Encoder:

  • An interrupt-driven quadrature decoder (ScoutRotaryInput) gives one step per detent.
  • Turning scrolls. A short press is Enter, and a long or double press is Back.
  • If the screen is off, the first turn only wakes it.

Status LEDs (ScoutStatusLeds):

  • LED1 (green) flashes on each received packet, with a faint heartbeat every 5 s.
  • LED2 (red) shows transmit.
  • LED3 and LED4 (purple) breathe while there are unread messages.
  • LED5 (blue) blinks while GPS is searching.
  • LED6 (yellow) blinks briefly once GPS has a fix.

Display > settings gets three new items: LED (on/off), LED Msg (on/off, controls the unread breathing) and LED Bright (4 steps). They are saved in NodePrefs as led, led_msg and led_lvl.

Changes to shared files (UITask.*, NodePrefs.h) are behind UI_HAS_STATUS_LEDS / UI_ENCODER_NAV, so other boards build the same code as before. This PR is on top of #33 because it extends the same variant.

Tested: I have run the same LED and encoder code on my Scout boards with an earlier South version. On this branch I checked that all BuildLab_Scout* envs build, and so do heltec_rc32_companion_radio_usb and Heltec_v3_companion_radio_ble.

The E22P is not wired like the E22-900M30S. Module pin 6 (GPIO17 on Scout)
is EN, a front-end enable that must stay HIGH in both directions, and pin 7
(GPIO3) is T/R CTRL: HIGH for TX, LOW for RX. The E22 envs drive GPIO17 as
RXEN, so on an E22P they switch the front end off for every transmission:
the node still hears, but its own packets barely leave the antenna.

New BuildLab_Scout_E22P_* envs reuse the E22 ones, drop SX126X_RXEN and set
P_LORA_RF_EN=17, which the board raises in begin(). On these builds the
board reports itself as "BuildLab Scout E22P", so it is clear which
firmware is on the device. Radio parameters (22 dBm on the SX1262,
TCXO 1.8 V, boosted RX gain) are unchanged, and the E22 envs build as before.
BuildLab Scout boards have six WS2812 LEDs on GPIO13 and a rotary
encoder (A=GPIO5, B=GPIO4, push button on GPIO6). This adds support for
both in the companion radio envs (E22 and E22P):

- ScoutRotaryInput: interrupt-driven quadrature decoder, one Next/Prev
  event per detent. Turn scrolls, short press = enter, long or double
  press = back. The first turn while the screen is off only wakes it.
- ScoutStatusLeds: LED1 RX flash and heartbeat, LED2 TX, LED3/LED4
  unread messages (breathing), LED5 GPS searching, LED6 GPS fix.
- Display settings: LED on/off, LED Msg on/off, LED Bright (4 steps),
  stored in NodePrefs.

Shared code changes are behind UI_HAS_STATUS_LEDS / UI_ENCODER_NAV, so
other boards are not affected.
With [esp32_ps] the status LEDs do not work as in the 1.17 build and the
USB-JTAG port no longer enters download mode on its own. The BOOT
button is not reachable in the Scout case, so the port has to work.
Same CPU and sleep settings as the 1.17 Scout build.
@BuildLabDIY

Copy link
Copy Markdown
Author

I removed [esp32_ps] from the Scout BLE companion env. The E22P env inherits it.

With power saving on, the status LEDs do not work as in the 1.17 build, on both E22 and E22P. The USB-JTAG port also stops entering download mode on its own: Windows shows error 31 for the port, and I could flash only in a short window right after a full power cycle. The BOOT button is not reachable in the Scout case.

Without power saving the build defines match the 1.17 Scout build. The power mode item in System settings is hidden, as in other builds without power saving.

Tested on E22P: LEDs on an incoming message, BLE PIN, flashing over USB. On E22: BLE PIN.

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