looks like GPS is getting a hickup... is it because of the power management chip?

This commit is contained in:
Peter Buchegger 2020-11-09 23:09:41 +01:00
parent 4228ffe235
commit 17f7a12ef8
3 changed files with 21 additions and 6 deletions

View file

@ -45,6 +45,7 @@ void setup()
powerManagement.activateLoRa(); powerManagement.activateLoRa();
powerManagement.activateOLED(); powerManagement.activateOLED();
powerManagement.activateGPS(); powerManagement.activateGPS();
powerManagement.activateMeasurement();
#endif #endif
delay(500); delay(500);
@ -97,8 +98,7 @@ void loop()
if(send_update && gps.location.isValid() && gps.location.isUpdated()) if(send_update && gps.location.isValid() && gps.location.isUpdated())
{ {
nextBeaconTimeStamp = nowTimeStamp + (BEACON_TIMEOUT * SECS_PER_MIN); powerManagement.deactivateMeasurement();
breakTime(nextBeaconTimeStamp, nextBeaconStruct);
send_update = false; send_update = false;
APRSMessage msg; APRSMessage msg;
@ -118,6 +118,7 @@ void loop()
// APRS Data: // APRS Data:
LoRa.write((const uint8_t *)data.c_str(), data.length()); LoRa.write((const uint8_t *)data.c_str(), data.length());
LoRa.endPacket(); LoRa.endPacket();
powerManagement.activateMeasurement();
} }
if(gps_time_update) if(gps_time_update)

View file

@ -13,10 +13,6 @@ bool PowerManagement::begin(TwoWire & port)
if(!result) if(!result)
{ {
axp.setDCDC1Voltage(3300); axp.setDCDC1Voltage(3300);
// Enable AXP ADC function
axp.adc1Enable(AXP202_BATT_CUR_ADC1 |
AXP202_BATT_VOL_ADC1,
true);
} }
return result; return result;
} }
@ -57,6 +53,21 @@ void PowerManagement::decativateOLED()
axp.setPowerOutPut(AXP192_DCDC1, AXP202_OFF); axp.setPowerOutPut(AXP192_DCDC1, AXP202_OFF);
} }
void PowerManagement::activateMeasurement()
{
axp.adc1Enable(AXP202_BATT_CUR_ADC1 |
AXP202_BATT_VOL_ADC1,
true);
}
void PowerManagement::deactivateMeasurement()
{
axp.adc1Enable(AXP202_BATT_CUR_ADC1 |
AXP202_BATT_VOL_ADC1,
false);
}
double PowerManagement::getBatteryVoltage() double PowerManagement::getBatteryVoltage()
{ {
return axp.getBattVoltage() / 1000.0; return axp.getBattVoltage() / 1000.0;

View file

@ -19,6 +19,9 @@ public:
void activateOLED(); void activateOLED();
void decativateOLED(); void decativateOLED();
void activateMeasurement();
void deactivateMeasurement();
double getBatteryVoltage(); double getBatteryVoltage();
double getBatteryChargeDischargeCurrent(); double getBatteryChargeDischargeCurrent();