mirror of
https://github.com/lora-aprs/LoRa_APRS_Tracker.git
synced 2025-12-06 07:12:15 +01:00
Merge pull request #6 from raufaser/master
Display next beacon time and battery voltage and (dis)charge current
This commit is contained in:
commit
f84f3269af
|
|
@ -23,7 +23,8 @@ String create_long_aprs(RawDegrees lng);
|
||||||
void setup_lora();
|
void setup_lora();
|
||||||
|
|
||||||
static time_t nowTimeStamp = -1;
|
static time_t nowTimeStamp = -1;
|
||||||
static time_t nextUpdateTimeStamp = -1;
|
static time_t nextBeaconTimeStamp = -1;
|
||||||
|
static tmElements_t nextBeaconStruct;
|
||||||
static bool send_update = true;
|
static bool send_update = true;
|
||||||
|
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
|
|
@ -75,7 +76,7 @@ void loop()
|
||||||
setTime(gps.time.hour(),gps.time.minute(),gps.time.second(),gps.date.day(),gps.date.month(),gps.date.year());
|
setTime(gps.time.hour(),gps.time.minute(),gps.time.second(),gps.date.day(),gps.date.month(),gps.date.year());
|
||||||
nowTimeStamp = now();
|
nowTimeStamp = now();
|
||||||
|
|
||||||
if (nextUpdateTimeStamp <= nowTimeStamp || nextUpdateTimeStamp == -1)
|
if (nextBeaconTimeStamp <= nowTimeStamp || nextBeaconTimeStamp == -1)
|
||||||
{
|
{
|
||||||
send_update = true;
|
send_update = true;
|
||||||
}
|
}
|
||||||
|
|
@ -83,7 +84,8 @@ void loop()
|
||||||
|
|
||||||
if(send_update && gps.location.isValid() && gps.location.isUpdated())
|
if(send_update && gps.location.isValid() && gps.location.isUpdated())
|
||||||
{
|
{
|
||||||
nextUpdateTimeStamp = nowTimeStamp + (BEACON_TIMEOUT * 60);
|
nextBeaconTimeStamp = nowTimeStamp + (BEACON_TIMEOUT * 60);
|
||||||
|
breakTime(nextBeaconTimeStamp, nextBeaconStruct);
|
||||||
send_update = false;
|
send_update = false;
|
||||||
|
|
||||||
APRSMessage msg;
|
APRSMessage msg;
|
||||||
|
|
@ -91,7 +93,7 @@ void loop()
|
||||||
msg.setDestination("APLT0");
|
msg.setDestination("APLT0");
|
||||||
String lat = create_lat_aprs(gps.location.rawLat());
|
String lat = create_lat_aprs(gps.location.rawLat());
|
||||||
String lng = create_long_aprs(gps.location.rawLng());
|
String lng = create_long_aprs(gps.location.rawLng());
|
||||||
msg.getAPRSBody()->setData(String("=") + lat + "/" + lng + ">" + BEACON_MESSAGE);
|
msg.getAPRSBody()->setData(String("=") + lat + SYMBOL_OVERLAY + lng + SYMBOL_CODE + BEACON_MESSAGE);
|
||||||
String data = msg.encode();
|
String data = msg.encode();
|
||||||
Serial.println(data);
|
Serial.println(data);
|
||||||
show_display("<< TX >>", data);
|
show_display("<< TX >>", data);
|
||||||
|
|
@ -107,12 +109,31 @@ void loop()
|
||||||
|
|
||||||
if(gps_time_update)
|
if(gps_time_update)
|
||||||
{
|
{
|
||||||
|
#ifdef TTGO_T_Beam_V1_0
|
||||||
|
char batteryVoltage[6];
|
||||||
|
dtostrf(axp.getBattVoltage()/1000, 1, 2, batteryVoltage);
|
||||||
|
|
||||||
|
char batteryChargeCurrent[6];
|
||||||
|
String batteryIndicator;
|
||||||
|
if(axp.isChargeing())
|
||||||
|
{
|
||||||
|
dtostrf(axp.getBattChargeCurrent(), 3, 0, batteryChargeCurrent);
|
||||||
|
batteryIndicator = "+";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dtostrf(axp.getBattDischargeCurrent(), 3, 0, batteryChargeCurrent);
|
||||||
|
batteryIndicator = "-";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
show_display(CALL,
|
show_display(CALL,
|
||||||
String("Time: ") + toDoubleInt(gps.time.hour()) + String(":") + toDoubleInt(gps.time.minute()) + String(":") + toDoubleInt(gps.time.second()),
|
toDoubleInt(gps.date.day()) + String(".") + toDoubleInt(gps.date.month()) + String(".") + gps.date.year() + String(" ") + toDoubleInt(gps.time.hour()) + String(":") + toDoubleInt(gps.time.minute()) + String(":") + toDoubleInt(gps.time.second()),
|
||||||
String("Date: ") + toDoubleInt(gps.date.day()) + String(".") + toDoubleInt(gps.date.month()) + String(".") + gps.date.year(),
|
String("Sats: ") + gps.satellites.value() + String(" HDOP: ") + gps.hdop.hdop(),
|
||||||
String("Sat's: ") + gps.satellites.value() + String(" HDOP: ") + gps.hdop.hdop(),
|
String("Nxt Bcn: ") + toDoubleInt(nextBeaconStruct.Hour) + String(":") + toDoubleInt(nextBeaconStruct.Minute)
|
||||||
String("Lat: ") + gps.location.lat() + String(" Lng: ") + gps.location.lng(),
|
#ifdef TTGO_T_Beam_V1_0
|
||||||
String("") + create_lat_aprs(gps.location.rawLat()) + String(" ") + create_long_aprs(gps.location.rawLng())
|
, String("Bat: ") + batteryVoltage + String("V ") + batteryIndicator + batteryChargeCurrent + String("mA")
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,6 +158,11 @@ void setup_axp()
|
||||||
axp.setPowerOutPut(AXP192_LDO3, AXP202_ON); // GPS
|
axp.setPowerOutPut(AXP192_LDO3, AXP202_ON); // GPS
|
||||||
axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON); // OLED
|
axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON); // OLED
|
||||||
axp.setDCDC1Voltage(3300);
|
axp.setDCDC1Voltage(3300);
|
||||||
|
|
||||||
|
/*Enable AXP ADC function*/
|
||||||
|
axp.adc1Enable(AXP202_BATT_CUR_ADC1 |
|
||||||
|
AXP202_BATT_VOL_ADC1,
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,7 @@
|
||||||
#define CALL "OE5BPA-7"
|
#define CALL "OE5BPA-7"
|
||||||
#define BEACON_MESSAGE "LoRa APRS Tracker test"
|
#define BEACON_MESSAGE "LoRa APRS Tracker test"
|
||||||
#define BEACON_TIMEOUT 1
|
#define BEACON_TIMEOUT 1
|
||||||
|
#define SYMBOL_CODE ">"
|
||||||
|
#define SYMBOL_OVERLAY "/"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue