mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-07-24 12:51:56 +00:00
GPS support was implemented incorrectly for the ThinkNode M3. The reset pin was being driven when it should be left floating for this unit. The enable pin also wasn't being picked up by `MicroNMEALocationProvider` because of a mismatch in constant naming conventions. I did a general cleanup of the GPS and ThinkNode M3 bring-up code so that constant names line up and "*_ACTIVE" constants are used consistently vs hardcoding `HIGH`/`LOW`. After making these changes, serial data immediately starts streaming in from the NMEA on boot and GPS detection just works. LED handling was also not quite right for the ThinkNode M3. The LoRa TX LED was being driven high to turn it on when it should actually be driven low. I changed the code to use the `LED_STATE_ON` constant and also added a little code to the shutdown path to properly make sure that all LEDs are turned off. Tested and confirmed working on real hardware. Resolves both #1864 and #2879.
55 lines
1.3 KiB
C++
55 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
#include <MeshCore.h>
|
|
#include <helpers/NRF52Board.h>
|
|
|
|
#define ADC_FACTOR ((1000.0*ADC_MULTIPLIER*AREF_VOLTAGE)/ADC_MAX)
|
|
|
|
class ThinkNodeM3Board : public NRF52BoardDCDC {
|
|
protected:
|
|
#if NRF52_POWER_MANAGEMENT
|
|
void initiateShutdown(uint8_t reason) override;
|
|
#endif
|
|
uint8_t btn_prev_state;
|
|
|
|
public:
|
|
ThinkNodeM3Board() : NRF52Board("THINKNODE_M3_OTA") {}
|
|
void begin();
|
|
uint16_t getBattMilliVolts() override;
|
|
|
|
#ifdef P_LORA_TX_LED
|
|
void onBeforeTransmit() override {
|
|
digitalWrite(P_LORA_TX_LED, LED_STATE_ON); // turn TX LED on
|
|
}
|
|
void onAfterTransmit() override {
|
|
digitalWrite(P_LORA_TX_LED, !LED_STATE_ON); // turn TX LED off
|
|
}
|
|
#endif
|
|
|
|
const char* getManufacturerName() const override {
|
|
return "Elecrow ThinkNode M3";
|
|
}
|
|
|
|
int buttonStateChanged() {
|
|
#ifdef BUTTON_PIN
|
|
uint8_t v = digitalRead(BUTTON_PIN);
|
|
if (v != btn_prev_state) {
|
|
btn_prev_state = v;
|
|
return (v == LOW) ? 1 : -1;
|
|
}
|
|
#endif
|
|
return 0;
|
|
}
|
|
|
|
void powerOff() override {
|
|
// turn off all leds, sd_power_system_off will not do this for us
|
|
digitalWrite(PIN_LED_BLUE, !LED_STATE_ON);
|
|
digitalWrite(PIN_LED_GREEN, !LED_STATE_ON);
|
|
digitalWrite(PIN_LED_RED, !LED_STATE_ON);
|
|
|
|
// power off board
|
|
sd_power_system_off();
|
|
}
|
|
};
|