mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-26 22:33:24 +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
|
||||
[portduino_base]
|
||||
platform = https://github.com/meshtastic/platform-native.git#9881bf3721d610cccacf5ae8e3a07839cce75d63
|
||||
platform = https://github.com/meshtastic/platform-native.git#f5ec3c031b0fcd89c0523de9e43eef3a92d59292
|
||||
framework = arduino
|
||||
|
||||
build_src_filter =
|
||||
|
@ -4,7 +4,7 @@
|
||||
"ldscript": "esp32_out.ld"
|
||||
},
|
||||
"core": "esp32",
|
||||
"extra_flags": "-DARDUINO_ESP32_DEV",
|
||||
"extra_flags": ["-DBOARD_HAS_PSRAM", "-DARDUINO_ESP32_DEV"],
|
||||
"f_cpu": "240000000L",
|
||||
"f_flash": "40000000L",
|
||||
"flash_mode": "dio",
|
||||
|
@ -133,4 +133,4 @@ lib_deps =
|
||||
https://github.com/lewisxhe/SensorLib#27fd0f721e20cd09e1f81383f0ba58a54fe84a17
|
||||
adafruit/Adafruit LSM6DS@^4.7.2
|
||||
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();
|
||||
#elif defined(ARCH_NRF52)
|
||||
return dbgHeapFree();
|
||||
#elif defined(ARCH_RP2040)
|
||||
return rp2040.getFreeHeap();
|
||||
#else
|
||||
// this platform does not have heap management function implemented
|
||||
return UINT32_MAX;
|
||||
@ -38,6 +40,8 @@ uint32_t MemGet::getHeapSize()
|
||||
return ESP.getHeapSize();
|
||||
#elif defined(ARCH_NRF52)
|
||||
return dbgHeapTotal();
|
||||
#elif defined(ARCH_RP2040)
|
||||
return rp2040.getTotalHeap();
|
||||
#else
|
||||
// this platform does not have heap management function implemented
|
||||
return UINT32_MAX;
|
||||
|
@ -5,17 +5,7 @@
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "SHT4XSensor.h"
|
||||
#include "TelemetrySensor.h"
|
||||
#include <SensirionI2cSht4x.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;
|
||||
#include <Adafruit_SHT4x.h>
|
||||
|
||||
SHT4XSensor::SHT4XSensor() : TelemetrySensor(meshtastic_TelemetrySensorType_SHT4X, "SHT4X") {}
|
||||
|
||||
@ -28,17 +18,15 @@ int32_t SHT4XSensor::runOnce()
|
||||
|
||||
uint32_t serialNumber = 0;
|
||||
|
||||
sht4x.begin(*nodeTelemetrySensorsMap[sensorType].second, 0x44);
|
||||
sht4x.begin(nodeTelemetrySensorsMap[sensorType].second);
|
||||
|
||||
error = sht4x.serialNumber(serialNumber);
|
||||
serialNumber = sht4x.readSerial();
|
||||
if (serialNumber != 0) {
|
||||
LOG_DEBUG("serialNumber : %x\n", serialNumber);
|
||||
if (error != NO_ERROR) {
|
||||
LOG_DEBUG("Error trying to execute serialNumber(): ");
|
||||
errorToString(error, errorMessage, sizeof errorMessage);
|
||||
LOG_DEBUG(errorMessage);
|
||||
status = 0;
|
||||
} else {
|
||||
status = 1;
|
||||
} else {
|
||||
LOG_DEBUG("Error trying to execute readSerial(): ");
|
||||
status = 0;
|
||||
}
|
||||
|
||||
return initI2CSensor();
|
||||
@ -51,12 +39,10 @@ void SHT4XSensor::setup()
|
||||
|
||||
bool SHT4XSensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
{
|
||||
float aTemperature = 0.0;
|
||||
float aHumidity = 0.0;
|
||||
sht4x.measureLowestPrecision(aTemperature, aHumidity);
|
||||
measurement->variant.environment_metrics.temperature = aTemperature;
|
||||
measurement->variant.environment_metrics.relative_humidity = aHumidity;
|
||||
|
||||
sensors_event_t humidity, temp;
|
||||
sht4x.getEvent(&humidity, &temp);
|
||||
measurement->variant.environment_metrics.temperature = temp.temperature;
|
||||
measurement->variant.environment_metrics.relative_humidity = humidity.relative_humidity;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -4,12 +4,12 @@
|
||||
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
#include <SensirionI2cSht4x.h>
|
||||
#include <Adafruit_SHT4x.h>
|
||||
|
||||
class SHT4XSensor : public TelemetrySensor
|
||||
{
|
||||
private:
|
||||
SensirionI2cSht4x sht4x;
|
||||
Adafruit_SHT4x sht4x = Adafruit_SHT4x();
|
||||
|
||||
protected:
|
||||
virtual void setup() override;
|
||||
|
@ -283,7 +283,7 @@ void portduinoSetup()
|
||||
}
|
||||
|
||||
for (configNames i : GPIO_lines) {
|
||||
if (settingsMap[i] > max_GPIO)
|
||||
if (settingsMap.count(i) && settingsMap[i] > max_GPIO)
|
||||
max_GPIO = settingsMap[i];
|
||||
}
|
||||
|
||||
@ -342,6 +342,7 @@ void portduinoSetup()
|
||||
if (settingsMap[touchscreenIRQ] > 0)
|
||||
initGPIOPin(settingsMap[touchscreenIRQ], gpioChipName);
|
||||
}
|
||||
|
||||
if (settingsStrings[spidev] != "") {
|
||||
SPI.begin(settingsStrings[spidev].c_str());
|
||||
}
|
||||
@ -350,6 +351,7 @@ void portduinoSetup()
|
||||
|
||||
int initGPIOPin(int pinNum, const std::string gpioChipName)
|
||||
{
|
||||
#ifdef PORTDUINO_LINUX_HARDWARE
|
||||
std::string gpio_name = "GPIO" + std::to_string(pinNum);
|
||||
try {
|
||||
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;
|
||||
return ERRNO_DISABLED;
|
||||
}
|
||||
#else
|
||||
return ERRNO_OK;
|
||||
#endif
|
||||
}
|
@ -264,7 +264,11 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false)
|
||||
#ifdef BUTTON_PIN
|
||||
// Avoid leakage through button pin
|
||||
if (GPIO_IS_VALID_OUTPUT_GPIO(BUTTON_PIN)) {
|
||||
#ifdef BUTTON_NEED_PULLUP
|
||||
pinMode(BUTTON_PIN, INPUT_PULLUP);
|
||||
#else
|
||||
pinMode(BUTTON_PIN, INPUT);
|
||||
#endif
|
||||
gpio_hold_en((gpio_num_t)BUTTON_PIN);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user