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

View file

@ -13,10 +13,6 @@ bool PowerManagement::begin(TwoWire & port)
if(!result)
{
axp.setDCDC1Voltage(3300);
// Enable AXP ADC function
axp.adc1Enable(AXP202_BATT_CUR_ADC1 |
AXP202_BATT_VOL_ADC1,
true);
}
return result;
}
@ -57,6 +53,21 @@ void PowerManagement::decativateOLED()
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()
{
return axp.getBattVoltage() / 1000.0;

View file

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