mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-07 06:04:38 +00:00
Merge branch 'master' of github.com:meshtastic/Meshtastic-device
This commit is contained in:
commit
2d4bfe183c
@ -1 +1 @@
|
||||
Subproject commit d3375fe599da1dd48572354325d3186eccf6f449
|
||||
Subproject commit 636212824a446194b73b02ca5c6c15cd61d3e007
|
@ -368,8 +368,21 @@ bool Power::axpChipInit()
|
||||
|
||||
#ifdef HAS_PMU
|
||||
|
||||
TwoWire * w = NULL;
|
||||
|
||||
// Use macro to distinguish which wire is used by PMU
|
||||
#ifdef PMU_USE_WIRE1
|
||||
w = &Wire1;
|
||||
#else
|
||||
w = &Wire;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* It is not necessary to specify the wire pin,
|
||||
* just input the wire, because the wire has been initialized in main.cpp
|
||||
*/
|
||||
if (!PMU) {
|
||||
PMU = new XPowersAXP2101(Wire, I2C_SDA, I2C_SCL);
|
||||
PMU = new XPowersAXP2101(*w);
|
||||
if (!PMU->init()) {
|
||||
DEBUG_MSG("Warning: Failed to find AXP2101 power management\n");
|
||||
delete PMU;
|
||||
@ -380,7 +393,7 @@ bool Power::axpChipInit()
|
||||
}
|
||||
|
||||
if (!PMU) {
|
||||
PMU = new XPowersAXP192(Wire, I2C_SDA, I2C_SCL);
|
||||
PMU = new XPowersAXP192(*w);
|
||||
if (!PMU->init()) {
|
||||
DEBUG_MSG("Warning: Failed to find AXP192 power management\n");
|
||||
delete PMU;
|
||||
@ -396,7 +409,9 @@ bool Power::axpChipInit()
|
||||
* In order not to affect other devices, if the initialization of the PMU fails, Wire needs to be re-initialized once,
|
||||
* if there are multiple devices sharing the bus.
|
||||
* * */
|
||||
Wire.begin(I2C_SDA, I2C_SCL);
|
||||
#ifndef PMU_USE_WIRE1
|
||||
w->begin(I2C_SDA, I2C_SCL);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -456,6 +471,23 @@ bool Power::axpChipInit()
|
||||
PMU->setPowerChannelVoltage(XPOWERS_DCDC3, 3300);
|
||||
PMU->enablePowerOutput(XPOWERS_DCDC3);
|
||||
|
||||
/**
|
||||
* ALDO2 cannot be turned off.
|
||||
* It is a necessary condition for sensor communication.
|
||||
* It must be turned on to properly access the sensor and screen
|
||||
* It is also responsible for the power supply of PCF8563
|
||||
*/
|
||||
PMU->setPowerChannelVoltage(XPOWERS_ALDO2, 3300);
|
||||
PMU->enablePowerOutput(XPOWERS_ALDO2);
|
||||
|
||||
// 6-axis , magnetometer ,bme280 , oled screen power channel
|
||||
PMU->setPowerChannelVoltage(XPOWERS_ALDO1, 3300);
|
||||
PMU->enablePowerOutput(XPOWERS_ALDO1);
|
||||
|
||||
// sdcard power channle
|
||||
PMU->setPowerChannelVoltage(XPOWERS_BLDO1, 3300);
|
||||
PMU->enablePowerOutput(XPOWERS_BLDO1);
|
||||
|
||||
// PMU->setPowerChannelVoltage(XPOWERS_DCDC4, 3300);
|
||||
// PMU->enablePowerOutput(XPOWERS_DCDC4);
|
||||
|
||||
|
@ -108,7 +108,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define MCP9808_ADDR 0x18
|
||||
#define INA_ADDR 0x40
|
||||
#define INA_ADDR_ALTERNATE 0x41
|
||||
|
||||
#define QMC6310_ADDR 0x1C
|
||||
#define QMI8658_ADDR 0x6B
|
||||
// -----------------------------------------------------------------------------
|
||||
// GPS
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -145,6 +145,14 @@ void scanI2Cdevice(void)
|
||||
nodeTelemetrySensorsMap[TelemetrySensorType_MCP9808] = addr;
|
||||
DEBUG_MSG("MCP9808 sensor found at address 0x%x\n", (uint8_t)addr);
|
||||
}
|
||||
if(addr == QMC6310_ADDR){
|
||||
DEBUG_MSG("QMC6310 3-Axis magnetic sensor found at address 0x%x\n", (uint8_t)addr);
|
||||
nodeTelemetrySensorsMap[TelemetrySensorType_QMC6310] = addr;
|
||||
}
|
||||
if(addr == QMI8658_ADDR){
|
||||
DEBUG_MSG("QMI8658 6-Axis inertial measurement sensor found at address 0x%x\n", (uint8_t)addr);
|
||||
nodeTelemetrySensorsMap[TelemetrySensorType_QMI8658] = addr;
|
||||
}
|
||||
} else if (err == 4) {
|
||||
DEBUG_MSG("Unknow error at address 0x%x\n", addr);
|
||||
}
|
||||
|
13
src/main.cpp
13
src/main.cpp
@ -87,7 +87,7 @@ uint32_t serialSinceMsec;
|
||||
bool pmu_found;
|
||||
|
||||
// Array map of sensor types (as array index) and i2c address as value we'll find in the i2c scan
|
||||
uint8_t nodeTelemetrySensorsMap[TelemetrySensorType_LPS22+1] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
uint8_t nodeTelemetrySensorsMap[TelemetrySensorType_QMI8658+1] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
Router *router = NULL; // Users of router don't care what sort of subclass implements that API
|
||||
|
||||
@ -214,6 +214,10 @@ void setup()
|
||||
// router = new DSRRouter();
|
||||
router = new ReliableRouter();
|
||||
|
||||
#ifdef I2C_SDA1
|
||||
Wire1.begin(I2C_SDA1, I2C_SCL1);
|
||||
#endif
|
||||
|
||||
#ifdef I2C_SDA
|
||||
Wire.begin(I2C_SDA, I2C_SCL);
|
||||
#elif HAS_WIRE
|
||||
@ -229,7 +233,6 @@ void setup()
|
||||
delay(1);
|
||||
#endif
|
||||
|
||||
scanI2Cdevice();
|
||||
#ifdef RAK4630
|
||||
// scanEInkDevice();
|
||||
#endif
|
||||
@ -269,6 +272,12 @@ void setup()
|
||||
powerStatus->observe(&power->newStatus);
|
||||
power->setup(); // Must be after status handler is installed, so that handler gets notified of the initial configuration
|
||||
|
||||
/*
|
||||
* Move the scanning I2C device to the back of power initialization.
|
||||
* Some boards need to be powered on to correctly scan to the device address, such as t-beam-s3-core
|
||||
*/
|
||||
scanI2Cdevice();
|
||||
|
||||
// Init our SPI controller (must be before screen and lora)
|
||||
initSPI();
|
||||
#ifndef ARCH_ESP32
|
||||
|
@ -18,7 +18,7 @@ extern bool pmu_found;
|
||||
extern bool isCharging;
|
||||
extern bool isUSBPowered;
|
||||
|
||||
extern uint8_t nodeTelemetrySensorsMap[TelemetrySensorType_LPS22+1];
|
||||
extern uint8_t nodeTelemetrySensorsMap[TelemetrySensorType_QMI8658+1];
|
||||
|
||||
extern int TCPPort; // set by Portduino
|
||||
|
||||
|
@ -29,7 +29,11 @@ typedef enum _TelemetrySensorType {
|
||||
/* High accuracy temperature and humidity */
|
||||
TelemetrySensorType_SHTC3 = 7,
|
||||
/* High accuracy pressure */
|
||||
TelemetrySensorType_LPS22 = 8
|
||||
TelemetrySensorType_LPS22 = 8,
|
||||
/* 3-Axis magnetic sensor */
|
||||
TelemetrySensorType_QMC6310 = 9,
|
||||
/* 6-Axis inertial measurement sensor */
|
||||
TelemetrySensorType_QMI8658 = 10
|
||||
} TelemetrySensorType;
|
||||
|
||||
/* Struct definitions */
|
||||
@ -81,8 +85,8 @@ typedef struct _Telemetry {
|
||||
|
||||
/* Helper constants for enums */
|
||||
#define _TelemetrySensorType_MIN TelemetrySensorType_SENSOR_UNSET
|
||||
#define _TelemetrySensorType_MAX TelemetrySensorType_LPS22
|
||||
#define _TelemetrySensorType_ARRAYSIZE ((TelemetrySensorType)(TelemetrySensorType_LPS22+1))
|
||||
#define _TelemetrySensorType_MAX TelemetrySensorType_QMI8658
|
||||
#define _TelemetrySensorType_ARRAYSIZE ((TelemetrySensorType)(TelemetrySensorType_QMI8658+1))
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -25,5 +25,12 @@ static const uint8_t MOSI = 11;
|
||||
static const uint8_t MISO = 13;
|
||||
static const uint8_t SCK = 12;
|
||||
|
||||
#define SDMMC_CMD (35)
|
||||
#define SDMMC_CLK (36)
|
||||
#define SDMMC_DATA (37)
|
||||
|
||||
#define ACCEL_INT1 (34)
|
||||
#define ACCEL_INT2 (33)
|
||||
#define RTC_INT (14)
|
||||
|
||||
#endif /* Pins_Arduino_h */
|
||||
|
@ -5,7 +5,9 @@ board = tbeam-s3-core
|
||||
|
||||
lib_deps =
|
||||
${esp32s3_base.lib_deps}
|
||||
lewisxhe/PCF8563_Library@1.0.1
|
||||
|
||||
build_flags =
|
||||
${esp32s3_base.build_flags}
|
||||
-Ivariants/tbeam-s3-core
|
||||
|
||||
-DPCF8563_RTC=0x51 ;Putting definitions in variant.h does not compile correctly
|
||||
|
@ -1,12 +1,18 @@
|
||||
// #define BUTTON_NEED_PULLUP // if set we need to turn on the internal CPU pullup during sleep
|
||||
|
||||
#define I2C_SDA 42
|
||||
#define I2C_SCL 41
|
||||
#define I2C_SDA1 42 //Used for PMU management
|
||||
#define I2C_SCL1 41 //Used for PMU management
|
||||
|
||||
#define I2C_SDA 17 //For sensors and screens
|
||||
#define I2C_SCL 18 //For sensors and screens
|
||||
|
||||
#define BUTTON_PIN 0 // The middle button GPIO on the T-Beam S3
|
||||
//#define BUTTON_PIN_ALT 13 // Alternate GPIO for an external button if needed. Does anyone use this? It is not documented anywhere.
|
||||
// #define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Module.
|
||||
|
||||
#define BUTTON1_PIN 47 //Additional keys
|
||||
|
||||
|
||||
#define LED_INVERTED 1
|
||||
// #define LED_PIN 4 // Newer tbeams (1.1) have an extra led on GPIO4
|
||||
|
||||
@ -36,6 +42,9 @@
|
||||
// #define PMU_IRQ 40
|
||||
#define HAS_AXP2101
|
||||
|
||||
// Specify the PMU as Wire1. In the t-beam-s3-core, the PMU enjoys a separate bus
|
||||
#define PMU_USE_WIRE1
|
||||
|
||||
#define RF95_SCK 12
|
||||
#define RF95_MISO 13
|
||||
#define RF95_MOSI 11
|
||||
@ -47,3 +56,10 @@
|
||||
#define GPS_1PPS_PIN 6
|
||||
|
||||
|
||||
#define HAS_SDCARD //Have 3-bit SDMMC interface SD card slot
|
||||
|
||||
// PCF8563 RTC Module
|
||||
// #define PCF8563_RTC 0x51 //Putting definitions in variant. h does not compile correctly
|
||||
|
||||
#define HAS_RTC 1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
[VERSION]
|
||||
major = 1
|
||||
minor = 3
|
||||
build = 42
|
||||
build = 43
|
||||
|
Loading…
Reference in New Issue
Block a user