This commit is contained in:
cyberman54 2021-01-30 17:54:34 +01:00
parent 44ce73a8b2
commit b5390d9e2c
6 changed files with 22 additions and 9 deletions

View File

@ -24,7 +24,7 @@
void i2c_init(void); void i2c_init(void);
void i2c_deinit(void); void i2c_deinit(void);
void i2c_scan(void); void i2c_scan(void);
uint8_t i2c_readBytes(uint8_t addr, uint8_t reg, uint8_t *data, uint8_t len); int i2c_readBytes(uint8_t addr, uint8_t reg, uint8_t *data, uint8_t len);
uint8_t i2c_writeBytes(uint8_t addr, uint8_t reg, uint8_t *data, uint8_t len); int i2c_writeBytes(uint8_t addr, uint8_t reg, uint8_t *data, uint8_t len);
#endif #endif

View File

@ -47,7 +47,7 @@ description = Paxcounter is a device for metering passenger flows in realtime. I
[common] [common]
; for release_version use max. 10 chars total, use any decimal format like "a.b.c" ; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
release_version = 2.2.0 release_version = 2.3.0
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running! ; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose ; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
debug_level = 3 debug_level = 3
@ -55,7 +55,7 @@ extra_scripts = pre:build.py
otakeyfile = ota.conf otakeyfile = ota.conf
lorakeyfile = loraconf.h lorakeyfile = loraconf.h
lmicconfigfile = lmic_config.h lmicconfigfile = lmic_config.h
platform_espressif32 = espressif32@2.1.0 platform_espressif32 = espressif32@3.0.0
monitor_speed = 115200 monitor_speed = 115200
upload_speed = 115200 ; set by build.py and taken from hal file upload_speed = 115200 ; set by build.py and taken from hal file
display_library = ; set by build.py and taken from hal file display_library = ; set by build.py and taken from hal file

View File

@ -119,7 +119,7 @@ time_t get_gpstime(uint16_t *msec) {
tm.Year = CalendarYrToTm(atoi(gpsyear.value())); // year offset from 1970 tm.Year = CalendarYrToTm(atoi(gpsyear.value())); // year offset from 1970
t = makeTime(tm); t = makeTime(tm);
ESP_LOGD(TAG, "GPS time/date = %2d:%2d:%2d / %2d.%2d.%2d", tm.Hour, ESP_LOGD(TAG, "GPS time/date = %02d:%02d:%02d / %02d.%02d.%2d", tm.Hour,
tm.Minute, tm.Second, tm.Day, tm.Month, tm.Year + 1970); tm.Minute, tm.Second, tm.Day, tm.Month, tm.Year + 1970);
// add protocol delay with millisecond precision // add protocol delay with millisecond precision

View File

@ -84,7 +84,7 @@ void i2c_scan(void) {
} }
// mutexed functions for i2c r/w access // mutexed functions for i2c r/w access
uint8_t i2c_readBytes(uint8_t addr, uint8_t reg, uint8_t *data, uint8_t len) { int i2c_readBytes(uint8_t addr, uint8_t reg, uint8_t *data, uint8_t len) {
if (I2C_MUTEX_LOCK()) { if (I2C_MUTEX_LOCK()) {
uint8_t ret = 0; uint8_t ret = 0;
@ -112,7 +112,7 @@ uint8_t i2c_readBytes(uint8_t addr, uint8_t reg, uint8_t *data, uint8_t len) {
} }
} }
uint8_t i2c_writeBytes(uint8_t addr, uint8_t reg, uint8_t *data, uint8_t len) { int i2c_writeBytes(uint8_t addr, uint8_t reg, uint8_t *data, uint8_t len) {
if (I2C_MUTEX_LOCK()) { if (I2C_MUTEX_LOCK()) {
uint8_t ret = 0; uint8_t ret = 0;

View File

@ -46,6 +46,14 @@ void AXP192_powerevent_IRQ(void) {
ESP_LOGI(TAG, "Battery high temperature."); ESP_LOGI(TAG, "Battery high temperature.");
if (pmu.isBattTempHighIRQ()) if (pmu.isBattTempHighIRQ())
ESP_LOGI(TAG, "Battery low temperature."); ESP_LOGI(TAG, "Battery low temperature.");
if (pmu.isLowVoltageLevel1IRQ()) {
ESP_LOGI(TAG, "Battery has reached voltage level 1.");
pmu.setChgLEDMode(AXP20X_LED_BLINK_4HZ);
}
if (pmu.isLowVoltageLevel2IRQ()) {
ESP_LOGI(TAG, "Battery has reached voltage level 2.");
pmu.setChgLEDMode(AXP20X_LED_BLINK_1HZ);
}
// short press -> esp32 deep sleep mode, can be exited by pressing user button // short press -> esp32 deep sleep mode, can be exited by pressing user button
if (pmu.isPEKShortPressIRQ()) { if (pmu.isPEKShortPressIRQ()) {
@ -129,10 +137,15 @@ void AXP192_init(void) {
pmu.setLDO2Voltage(3300); // LORA VDD 3v3 pmu.setLDO2Voltage(3300); // LORA VDD 3v3
pmu.setLDO3Voltage(3300); // GPS VDD 3v3 pmu.setLDO3Voltage(3300); // GPS VDD 3v3
// configure voltage warning levels
pmu.setVWarningLevel1(3600);
pmu.setVWarningLevel2(3800);
pmu.setPowerDownVoltage(3300);
// configure PEK button settings // configure PEK button settings
pmu.setTimeOutShutdown(false); // forced shutdown by PEK enabled pmu.setTimeOutShutdown(false); // forced shutdown by PEK enabled
pmu.setShutdownTime( pmu.setShutdownTime(
AXP_POWER_OFF_TIME_65); // 6 sec button press for shutdown AXP_POWER_OFF_TIME_6S); // 6 sec button press for shutdown
pmu.setlongPressTime( pmu.setlongPressTime(
AXP_LONGPRESS_TIME_1S5); // 1.5 sec button press for long press AXP_LONGPRESS_TIME_1S5); // 1.5 sec button press for long press
pmu.setStartupTime( pmu.setStartupTime(

View File

@ -166,7 +166,7 @@ void set_payloadmask(uint8_t val[]) {
void set_sensor(uint8_t val[]) { void set_sensor(uint8_t val[]) {
#if (HAS_SENSORS) #if (HAS_SENSORS)
switch (val[0]) { // check if valid sensor number 1...4 switch (val[0]) { // check if valid sensor number 1..3
case 1: case 1:
case 2: case 2:
case 3: case 3: