Move RAK9154 to variants, fix json

This commit is contained in:
beegee-tokyo 2024-06-16 19:45:17 +08:00
parent 5e01b4251f
commit 85d621d9c6
6 changed files with 36 additions and 32 deletions

View File

@ -2,9 +2,8 @@
// See http://go.microsoft.com/fwlink/?LinkId=827846 // See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format // for the documentation about the extensions.json format
"recommendations": [ "recommendations": [
"platformio.platformio-ide" "ms-vscode.cpptools",
"platformio.platformio-ide",
"trunk.io"
], ],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
} }

View File

@ -2,7 +2,7 @@
; https://docs.platformio.org/page/projectconf.html ; https://docs.platformio.org/page/projectconf.html
[platformio] [platformio]
default_envs = tbeam ;default_envs = tbeam
;default_envs = pico ;default_envs = pico
;default_envs = tbeam-s3-core ;default_envs = tbeam-s3-core
;default_envs = tbeam0.7 ;default_envs = tbeam0.7
@ -29,7 +29,7 @@ default_envs = tbeam
;default_envs = meshtastic-dr-dev ;default_envs = meshtastic-dr-dev
;default_envs = m5stack-coreink ;default_envs = m5stack-coreink
;default_envs = rak4631 ;default_envs = rak4631
;default_envs = rak2560 default_envs = rak2560
;default_envs = rak10701 ;default_envs = rak10701
;default_envs = wio-e5 ;default_envs = wio-e5
;default_envs = radiomaster_900_bandit_nano ;default_envs = radiomaster_900_bandit_nano

View File

@ -2,6 +2,8 @@
#include "PowerStatus.h" #include "PowerStatus.h"
#include "concurrency/OSThread.h" #include "concurrency/OSThread.h"
#include "configuration.h" #include "configuration.h"
#include "../variants/rak2560/RAK9154Sensor.h"
#ifdef ARCH_ESP32 #ifdef ARCH_ESP32
#include <esp_adc_cal.h> #include <esp_adc_cal.h>
#include <soc/adc_channel.h> #include <soc/adc_channel.h>
@ -47,14 +49,14 @@ extern INA3221Sensor ina3221Sensor;
#endif #endif
#if HAS_RAKPROT && !defined(ARCH_PORTDUINO) #if HAS_RAKPROT && !defined(ARCH_PORTDUINO)
#include "modules/Telemetry/Sensor/RAK9154Sensor.h" #include "../variants/rak2560/RAK9154Sensor.h"
extern RAK9154Sensor rak9154Sensor; extern RAK9154Sensor rak9154Sensor;
#endif #endif
class Power : private concurrency::OSThread class Power : private concurrency::OSThread
{ {
public: public:
Observable<const meshtastic::PowerStatus *> newStatus; Observable<const meshtastic::PowerStatus *> newStatus;
Power(); Power();
@ -66,7 +68,7 @@ class Power : private concurrency::OSThread
void setStatusHandler(meshtastic::PowerStatus *handler) { statusHandler = handler; } void setStatusHandler(meshtastic::PowerStatus *handler) { statusHandler = handler; }
const uint16_t OCV[11] = {OCV_ARRAY}; const uint16_t OCV[11] = {OCV_ARRAY};
protected: protected:
meshtastic::PowerStatus *statusHandler; meshtastic::PowerStatus *statusHandler;
/// Setup a xpowers chip axp192/axp2101, return true if found /// Setup a xpowers chip axp192/axp2101, return true if found
@ -74,7 +76,7 @@ class Power : private concurrency::OSThread
/// Setup a simple ADC input based battery sensor /// Setup a simple ADC input based battery sensor
bool analogInit(); bool analogInit();
private: private:
// open circuit voltage lookup table // open circuit voltage lookup table
uint8_t low_voltage_counter; uint8_t low_voltage_counter;
#ifdef DEBUG_HEAP #ifdef DEBUG_HEAP

View File

@ -1,7 +1,7 @@
#ifdef HAS_RAKPROT #ifdef HAS_RAKPROT
#include "RAK9154Sensor.h" #include "../variants/rak2560/RAK9154Sensor.h"
#include "../mesh/generated/meshtastic/telemetry.pb.h" #include "../mesh/generated/meshtastic/telemetry.pb.h"
#include "TelemetrySensor.h" #include "../modules/Telemetry/Sensor/TelemetrySensor.h"
#include "configuration.h" #include "configuration.h"
#include <RAK-OneWireSerial.h> #include <RAK-OneWireSerial.h>

View File

@ -1,7 +1,9 @@
#ifdef HAS_RAKPROT #ifdef HAS_RAKPROT
#ifndef _RAK9154SENSOR_H
#define _RAK9154SENSOR_H 1
#include "../mesh/generated/meshtastic/telemetry.pb.h" #include "../mesh/generated/meshtastic/telemetry.pb.h"
#include "TelemetrySensor.h" #include "../modules/Telemetry/Sensor/TelemetrySensor.h"
#include "VoltageSensor.h" #include "../modules/Telemetry/Sensor/VoltageSensor.h"
class RAK9154Sensor : public TelemetrySensor, VoltageSensor class RAK9154Sensor : public TelemetrySensor, VoltageSensor
{ {
@ -17,4 +19,5 @@ class RAK9154Sensor : public TelemetrySensor, VoltageSensor
int getBusBatteryPercent(); int getBusBatteryPercent();
bool isCharging(); bool isCharging();
}; };
#endif // _RAK9154SENSOR_H
#endif // HAS_RAKPROT #endif // HAS_RAKPROT

View File

@ -10,7 +10,7 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/rak4631 -D RAK_4631
-DEINK_WIDTH=250 -DEINK_WIDTH=250
-DEINK_HEIGHT=122 -DEINK_HEIGHT=122
-DHAS_RAKPROT=1 ; Define if RAk OneWireSerial is used (disables GPS) -DHAS_RAKPROT=1 ; Define if RAk OneWireSerial is used (disables GPS)
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak4631> +<mesh/eth/> +<mesh/api/> +<mqtt/> build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak4631> +<../variants/rak2560> +<mesh/eth/> +<mesh/api/> +<mqtt/>
lib_deps = lib_deps =
${nrf52840_base.lib_deps} ${nrf52840_base.lib_deps}
${networking_base.lib_deps} ${networking_base.lib_deps}