Merge pull request #451 from cyberman54/master

Sync dev to master
This commit is contained in:
Verkehrsrot 2019-09-21 08:27:49 +02:00 committed by GitHub
commit a2e861844f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 7 deletions

View File

@ -75,7 +75,7 @@
#define TIME_SYNC_INTERVAL_RETRY 10 // retry time sync after lost sync each .. minutes [default = 10], 0 means off #define TIME_SYNC_INTERVAL_RETRY 10 // retry time sync after lost sync each .. minutes [default = 10], 0 means off
#define TIME_SYNC_COMPILEDATE 0 // set to 1 to use compile date to initialize RTC after power outage [default = 0] #define TIME_SYNC_COMPILEDATE 0 // set to 1 to use compile date to initialize RTC after power outage [default = 0]
#define TIME_SYNC_LORAWAN 0 // set to 1 to use LORA network as time source, 0 means off [default = 0] #define TIME_SYNC_LORAWAN 0 // set to 1 to use LORA network as time source, 0 means off [default = 0]
#define TIME_SYNC_LORASERVER 1 // set to 1 to use LORA timeserver as time source, 0 means off [default = 0] #define TIME_SYNC_LORASERVER 0 // set to 1 to use LORA timeserver as time source, 0 means off [default = 0]
// settings for syncing time with timeserver applications // settings for syncing time with timeserver applications
#define TIME_SYNC_SAMPLES 1 // number of time requests for averaging #define TIME_SYNC_SAMPLES 1 // number of time requests for averaging

View File

@ -16,9 +16,10 @@ void pover_event_IRQ(void) {
// put your power event handler code here // put your power event handler code here
if (pmu.isVbusOverVoltageIRQ()) if (pmu.isVbusOverVoltageIRQ())
ESP_LOGI(TAG, "USB voltage %.1fV too high.", pmu.getVbusVoltage()); ESP_LOGI(TAG, "USB voltage %.2fV too high.", pmu.getVbusVoltage() / 1000);
if (pmu.isVbusPlugInIRQ()) if (pmu.isVbusPlugInIRQ())
ESP_LOGI(TAG, "USB plugged."); ESP_LOGI(TAG, "USB plugged, %.2fV @ %.0mA", pmu.getVbusVoltage() / 1000,
pmu.getVbusCurrent());
if (pmu.isVbusRemoveIRQ()) if (pmu.isVbusRemoveIRQ())
ESP_LOGI(TAG, "USB unplugged."); ESP_LOGI(TAG, "USB unplugged.");
@ -78,14 +79,16 @@ void AXP192_power(bool on) {
void AXP192_displaypower(void) { void AXP192_displaypower(void) {
if (pmu.isBatteryConnect()) if (pmu.isBatteryConnect())
if (pmu.isChargeing()) if (pmu.isChargeing())
ESP_LOGI(TAG, "Battery charging @ %.0fmAh", pmu.getBattChargeCurrent()); ESP_LOGI(TAG, "Battery charging, %.2fV @ %.0fmAh",
pmu.getBattVoltage() / 1000, pmu.getBattChargeCurrent());
else else
ESP_LOGI(TAG, "Battery not charging"); ESP_LOGI(TAG, "Battery not charging");
else else
ESP_LOGI(TAG, "No Battery"); ESP_LOGI(TAG, "No Battery");
if (pmu.isVBUSPlug()) if (pmu.isVBUSPlug())
ESP_LOGI(TAG, "USB present"); ESP_LOGI(TAG, "USB present, %.2fV @ %.0fmA", pmu.getVbusVoltage() / 1000,
pmu.getVbusCurrent());
else else
ESP_LOGI(TAG, "USB not present"); ESP_LOGI(TAG, "USB not present");
} }
@ -101,9 +104,14 @@ void AXP192_init(void) {
// switch power on // switch power on
pmu.setDCDC1Voltage(3300); // for external OLED display pmu.setDCDC1Voltage(3300); // for external OLED display
pmu.adc1Enable(AXP202_BATT_CUR_ADC1, 1);
AXP192_power(true); AXP192_power(true);
// switch ADCs on
pmu.adc1Enable(AXP202_BATT_VOL_ADC1, true);
pmu.adc1Enable(AXP202_BATT_CUR_ADC1, true);
pmu.adc1Enable(AXP202_VBUS_VOL_ADC1, true);
pmu.adc1Enable(AXP202_VBUS_CUR_ADC1, true);
// set TS pin mode off to save power // set TS pin mode off to save power
pmu.setTSmode(AXP_TS_PIN_MODE_DISABLE); pmu.setTSmode(AXP_TS_PIN_MODE_DISABLE);