mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-18 11:02:16 +00:00
Merge branch 'master' into tft-gui-work
This commit is contained in:
commit
ff9c7da0c1
@ -1,6 +1,6 @@
|
|||||||
; The Portduino based sim environment on top of any host OS, all hardware will be simulated
|
; The Portduino based sim environment on top of any host OS, all hardware will be simulated
|
||||||
[portduino_base]
|
[portduino_base]
|
||||||
platform = https://github.com/meshtastic/platform-native.git#9881bf3721d610cccacf5ae8e3a07839cce75d63
|
platform = https://github.com/meshtastic/platform-native.git#f5ec3c031b0fcd89c0523de9e43eef3a92d59292
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"ldscript": "esp32_out.ld"
|
"ldscript": "esp32_out.ld"
|
||||||
},
|
},
|
||||||
"core": "esp32",
|
"core": "esp32",
|
||||||
"extra_flags": "-DARDUINO_ESP32_DEV",
|
"extra_flags": ["-DBOARD_HAS_PSRAM", "-DARDUINO_ESP32_DEV"],
|
||||||
"f_cpu": "240000000L",
|
"f_cpu": "240000000L",
|
||||||
"f_flash": "40000000L",
|
"f_flash": "40000000L",
|
||||||
"flash_mode": "dio",
|
"flash_mode": "dio",
|
||||||
|
@ -133,4 +133,4 @@ lib_deps =
|
|||||||
https://github.com/lewisxhe/SensorLib#27fd0f721e20cd09e1f81383f0ba58a54fe84a17
|
https://github.com/lewisxhe/SensorLib#27fd0f721e20cd09e1f81383f0ba58a54fe84a17
|
||||||
adafruit/Adafruit LSM6DS@^4.7.2
|
adafruit/Adafruit LSM6DS@^4.7.2
|
||||||
mprograms/QMC5883LCompass@^1.2.0
|
mprograms/QMC5883LCompass@^1.2.0
|
||||||
https://github.com/Sensirion/arduino-i2c-sht4x#1.1.0
|
https://github.com/adafruit/Adafruit_SHT4X#1.0.4
|
@ -22,6 +22,8 @@ uint32_t MemGet::getFreeHeap()
|
|||||||
return ESP.getFreeHeap();
|
return ESP.getFreeHeap();
|
||||||
#elif defined(ARCH_NRF52)
|
#elif defined(ARCH_NRF52)
|
||||||
return dbgHeapFree();
|
return dbgHeapFree();
|
||||||
|
#elif defined(ARCH_RP2040)
|
||||||
|
return rp2040.getFreeHeap();
|
||||||
#else
|
#else
|
||||||
// this platform does not have heap management function implemented
|
// this platform does not have heap management function implemented
|
||||||
return UINT32_MAX;
|
return UINT32_MAX;
|
||||||
@ -38,6 +40,8 @@ uint32_t MemGet::getHeapSize()
|
|||||||
return ESP.getHeapSize();
|
return ESP.getHeapSize();
|
||||||
#elif defined(ARCH_NRF52)
|
#elif defined(ARCH_NRF52)
|
||||||
return dbgHeapTotal();
|
return dbgHeapTotal();
|
||||||
|
#elif defined(ARCH_RP2040)
|
||||||
|
return rp2040.getTotalHeap();
|
||||||
#else
|
#else
|
||||||
// this platform does not have heap management function implemented
|
// this platform does not have heap management function implemented
|
||||||
return UINT32_MAX;
|
return UINT32_MAX;
|
||||||
|
@ -5,17 +5,7 @@
|
|||||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "SHT4XSensor.h"
|
#include "SHT4XSensor.h"
|
||||||
#include "TelemetrySensor.h"
|
#include "TelemetrySensor.h"
|
||||||
#include <SensirionI2cSht4x.h>
|
#include <Adafruit_SHT4x.h>
|
||||||
|
|
||||||
// macro definitions
|
|
||||||
// make sure that we use the proper definition of NO_ERROR
|
|
||||||
#ifdef NO_ERROR
|
|
||||||
#undef NO_ERROR
|
|
||||||
#endif
|
|
||||||
#define NO_ERROR 0
|
|
||||||
|
|
||||||
static char errorMessage[64];
|
|
||||||
static int16_t error;
|
|
||||||
|
|
||||||
SHT4XSensor::SHT4XSensor() : TelemetrySensor(meshtastic_TelemetrySensorType_SHT4X, "SHT4X") {}
|
SHT4XSensor::SHT4XSensor() : TelemetrySensor(meshtastic_TelemetrySensorType_SHT4X, "SHT4X") {}
|
||||||
|
|
||||||
@ -28,17 +18,15 @@ int32_t SHT4XSensor::runOnce()
|
|||||||
|
|
||||||
uint32_t serialNumber = 0;
|
uint32_t serialNumber = 0;
|
||||||
|
|
||||||
sht4x.begin(*nodeTelemetrySensorsMap[sensorType].second, 0x44);
|
sht4x.begin(nodeTelemetrySensorsMap[sensorType].second);
|
||||||
|
|
||||||
error = sht4x.serialNumber(serialNumber);
|
serialNumber = sht4x.readSerial();
|
||||||
LOG_DEBUG("serialNumber : %x\n", serialNumber);
|
if (serialNumber != 0) {
|
||||||
if (error != NO_ERROR) {
|
LOG_DEBUG("serialNumber : %x\n", serialNumber);
|
||||||
LOG_DEBUG("Error trying to execute serialNumber(): ");
|
|
||||||
errorToString(error, errorMessage, sizeof errorMessage);
|
|
||||||
LOG_DEBUG(errorMessage);
|
|
||||||
status = 0;
|
|
||||||
} else {
|
|
||||||
status = 1;
|
status = 1;
|
||||||
|
} else {
|
||||||
|
LOG_DEBUG("Error trying to execute readSerial(): ");
|
||||||
|
status = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return initI2CSensor();
|
return initI2CSensor();
|
||||||
@ -51,12 +39,10 @@ void SHT4XSensor::setup()
|
|||||||
|
|
||||||
bool SHT4XSensor::getMetrics(meshtastic_Telemetry *measurement)
|
bool SHT4XSensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||||
{
|
{
|
||||||
float aTemperature = 0.0;
|
sensors_event_t humidity, temp;
|
||||||
float aHumidity = 0.0;
|
sht4x.getEvent(&humidity, &temp);
|
||||||
sht4x.measureLowestPrecision(aTemperature, aHumidity);
|
measurement->variant.environment_metrics.temperature = temp.temperature;
|
||||||
measurement->variant.environment_metrics.temperature = aTemperature;
|
measurement->variant.environment_metrics.relative_humidity = humidity.relative_humidity;
|
||||||
measurement->variant.environment_metrics.relative_humidity = aHumidity;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
#include "TelemetrySensor.h"
|
#include "TelemetrySensor.h"
|
||||||
#include <SensirionI2cSht4x.h>
|
#include <Adafruit_SHT4x.h>
|
||||||
|
|
||||||
class SHT4XSensor : public TelemetrySensor
|
class SHT4XSensor : public TelemetrySensor
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
SensirionI2cSht4x sht4x;
|
Adafruit_SHT4x sht4x = Adafruit_SHT4x();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void setup() override;
|
virtual void setup() override;
|
||||||
|
@ -283,7 +283,7 @@ void portduinoSetup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (configNames i : GPIO_lines) {
|
for (configNames i : GPIO_lines) {
|
||||||
if (settingsMap[i] > max_GPIO)
|
if (settingsMap.count(i) && settingsMap[i] > max_GPIO)
|
||||||
max_GPIO = settingsMap[i];
|
max_GPIO = settingsMap[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,6 +342,7 @@ void portduinoSetup()
|
|||||||
if (settingsMap[touchscreenIRQ] > 0)
|
if (settingsMap[touchscreenIRQ] > 0)
|
||||||
initGPIOPin(settingsMap[touchscreenIRQ], gpioChipName);
|
initGPIOPin(settingsMap[touchscreenIRQ], gpioChipName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingsStrings[spidev] != "") {
|
if (settingsStrings[spidev] != "") {
|
||||||
SPI.begin(settingsStrings[spidev].c_str());
|
SPI.begin(settingsStrings[spidev].c_str());
|
||||||
}
|
}
|
||||||
@ -350,6 +351,7 @@ void portduinoSetup()
|
|||||||
|
|
||||||
int initGPIOPin(int pinNum, const std::string gpioChipName)
|
int initGPIOPin(int pinNum, const std::string gpioChipName)
|
||||||
{
|
{
|
||||||
|
#ifdef PORTDUINO_LINUX_HARDWARE
|
||||||
std::string gpio_name = "GPIO" + std::to_string(pinNum);
|
std::string gpio_name = "GPIO" + std::to_string(pinNum);
|
||||||
try {
|
try {
|
||||||
GPIOPin *csPin;
|
GPIOPin *csPin;
|
||||||
@ -362,4 +364,7 @@ int initGPIOPin(int pinNum, const std::string gpioChipName)
|
|||||||
std::cout << "Warning, cannot claim pin " << gpio_name << (p ? p.__cxa_exception_type()->name() : "null") << std::endl;
|
std::cout << "Warning, cannot claim pin " << gpio_name << (p ? p.__cxa_exception_type()->name() : "null") << std::endl;
|
||||||
return ERRNO_DISABLED;
|
return ERRNO_DISABLED;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
return ERRNO_OK;
|
||||||
|
#endif
|
||||||
}
|
}
|
@ -264,7 +264,11 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false)
|
|||||||
#ifdef BUTTON_PIN
|
#ifdef BUTTON_PIN
|
||||||
// Avoid leakage through button pin
|
// Avoid leakage through button pin
|
||||||
if (GPIO_IS_VALID_OUTPUT_GPIO(BUTTON_PIN)) {
|
if (GPIO_IS_VALID_OUTPUT_GPIO(BUTTON_PIN)) {
|
||||||
|
#ifdef BUTTON_NEED_PULLUP
|
||||||
|
pinMode(BUTTON_PIN, INPUT_PULLUP);
|
||||||
|
#else
|
||||||
pinMode(BUTTON_PIN, INPUT);
|
pinMode(BUTTON_PIN, INPUT);
|
||||||
|
#endif
|
||||||
gpio_hold_en((gpio_num_t)BUTTON_PIN);
|
gpio_hold_en((gpio_num_t)BUTTON_PIN);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user