Skip to content

fix(variants): RAK3112 octal PSRAM, battery reading and Heltec pin leftovers (port of #14 to dmc-dev) - #15

Merged
Elektr0Vodka merged 3 commits into
dmc-devfrom
fix/dmc-dev-rak3112-octal-psram
Oct 15, 2026
Merged

Elektr0Vodka merged 3 commits into
dmc-devfrom
fix/dmc-dev-rak3112-octal-psram

Conversation

@Elektr0Vodka

Copy link
Copy Markdown

Port of the RAK3112 variant fixes from #14 by @hp197 to the dmc-dev base, so the non-MQTT RAK3112 builds (repeater, room server, companions, sensor, bridges) get them too. #14 itself targets dmc-observer-dev; upstream v1.18.0 still has the old setup.

Problem

(Issues are disabled on this repo, so the rationale is here, per AGENTS.md §6. Full analysis and hardware results are in #14.)

The RAK3112 variant was derived from Heltec V3 and kept things that are wrong for the RAK3112 (ESP32-S3R8):

  1. Octal PSRAM never comes up. The esp32-s3-devkitc-1 board defaults to quad PSRAM (qio_qspi); the RAK3112 has 8 MB octal PSRAM.
  2. Heltec pin leftovers on octal-PSRAM lines (GPIO33–37): PIN_ADC_CTRL (GPIO36) was driven as an output in begin(), and the sensor env started a second I2C bus on GPIO33/34.
  3. Battery voltage used the RAK4631 (nRF52, 3.0 V AREF) formula, which does not fit the ESP32-S3 ADC.

Changes (only variants/rak3112/)

The three commits from #14, cherry-picked with -x, authorship kept (@hp197):

  • fix(variants): enable octal PSRAM on RAK3112: board_build.arduino.memory_type = qio_opi and BOARD_HAS_PSRAM=1 in [rak3112].
  • fix(variants): drop Heltec V3 pin leftovers from RAK3112: removes the PIN_ADC_CTRL logic and ENV_PIN_SDA/SCL=33/34; sensor advert renamed "RAK3112 Sensor".
  • fix(variants): correct RAK3112 battery voltage reading: analogReadMilliVolts() (eFuse-calibrated) × 1.73 for the WisBlock base board divider.

Difference from #14: the *_observer_mqtt hunks (dropping MQTT_NEIGHBORS_WITHOUT_PSRAM and ENV_PIN_* from the observer envs) are left out, because those envs do not exist on dmc-dev; that was the only conflict. RAK3112Board.h is byte-identical to #14, and every platformio.ini section present on both branches matches.

Verified

On this branch (Windows, PlatformIO):

  • pio run for all 10 RAK_3112_* envs: all build. repeater, repeater_bridge_rs232, repeater_bridge_espnow, room_server, terminal_chat, companion_radio_usb/ble/wifi, sensor, kiss_modem.
  • pio test -e native: 179/179 passed.

Not verified by me: no hardware flash of these dmc-dev builds. The PSRAM/MQTT behaviour was verified on hardware by @hp197 in #14 (observer room server: PSRAM found, 8 MB). The ×1.73 battery factor still lacks a multimeter check, as noted in #14.

🤖 Generated with Claude Code

hp197 and others added 3 commits October 15, 2026 19:50
The RAK3112 (ESP32-S3R8) has 8MB octal PSRAM, but the variant used the
esp32-s3-devkitc-1 default memory type (qio_qspi). Booting with
BOARD_HAS_PSRAM then fails with "PSRAM ID read error ... wrong PSRAM line
mode", so the variant ran without PSRAM and the observer envs needed
MQTT_NEIGHBORS_WITHOUT_PSRAM to spend internal DRAM on the neighbors table.

Set memory_type = qio_opi and BOARD_HAS_PSRAM; the neighbors table and
TLS buffers now go to PSRAM and the opt-in flag is no longer needed.

On dmc-dev only the [rak3112] base change applies; the observer envs and
their MQTT_NEIGHBORS_WITHOUT_PSRAM hunks do not exist on this branch.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 417a112)
The RAK3112 variant was derived from Heltec V3 and kept two of its pin
assignments that collide with the RAK3112's octal PSRAM (GPIO33-37):

- PIN_ADC_CTRL (GPIO36) was driven as an output in begin(); the RAK3112
  has no ADC enable pin.
- ENV_PIN_SDA/SCL=33/34 started a second I2C bus on PSRAM data lines in
  the sensor and observer envs. External sensors on WisBlock slots sit on
  the main I2C bus (PIN_BOARD_SDA/SCL = 9/40).

Also rename the sensor advert from "RAK3112 v3 Sensor" to "RAK3112 Sensor".

On dmc-dev the observer-env hunks do not apply (no observer envs on this
branch); the board header and the RAK_3112_sensor env changes are unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 2e33e8e)
getBattMilliVolts() used the RAK4631 formula (raw * 3 * 1.73 * 1.187 / 4096),
which assumes the nRF52's 3.0V ADC reference and does not apply to the
ESP32-S3 ADC. Use the calibrated analogReadMilliVolts() and the WisBlock
base board divider (1M/1.5M, empirical x1.73 as Meshtastic uses for the
RAK4631 on the same base boards).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 12f0c97)
@Elektr0Vodka
Elektr0Vodka merged commit 3ed1d5f into dmc-dev Oct 15, 2026
1 check passed
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.

2 participants