fix altitude for telemetry, instead of using zero
This commit is contained in:
@@ -11,8 +11,9 @@
|
|||||||
class SensorManager {
|
class SensorManager {
|
||||||
public:
|
public:
|
||||||
double node_lat, node_lon; // modify these, if you want to affect Advert location
|
double node_lat, node_lon; // modify these, if you want to affect Advert location
|
||||||
|
double node_altitude; // altitude in meters
|
||||||
|
|
||||||
SensorManager() { node_lat = 0; node_lon = 0; }
|
SensorManager() { node_lat = 0; node_lon = 0; node_altitude = 0; }
|
||||||
virtual bool begin() { return false; }
|
virtual bool begin() { return false; }
|
||||||
virtual bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) { return false; }
|
virtual bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) { return false; }
|
||||||
virtual void loop() { }
|
virtual void loop() { }
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ class LocationProvider {
|
|||||||
public:
|
public:
|
||||||
virtual long getLatitude() = 0;
|
virtual long getLatitude() = 0;
|
||||||
virtual long getLongitude() = 0;
|
virtual long getLongitude() = 0;
|
||||||
|
virtual long getAltitude() = 0;
|
||||||
virtual bool isValid() = 0;
|
virtual bool isValid() = 0;
|
||||||
virtual long getTimestamp() = 0;
|
virtual long getTimestamp() = 0;
|
||||||
virtual void reset();
|
virtual void reset();
|
||||||
|
|||||||
@@ -61,6 +61,11 @@ public :
|
|||||||
|
|
||||||
long getLatitude() override { return nmea.getLatitude(); }
|
long getLatitude() override { return nmea.getLatitude(); }
|
||||||
long getLongitude() override { return nmea.getLongitude(); }
|
long getLongitude() override { return nmea.getLongitude(); }
|
||||||
|
long getAltitude() override {
|
||||||
|
long alt = 0;
|
||||||
|
nmea.getAltitude(alt);
|
||||||
|
return alt;
|
||||||
|
}
|
||||||
bool isValid() override { return nmea.isValid(); }
|
bool isValid() override { return nmea.isValid(); }
|
||||||
|
|
||||||
long getTimestamp() override {
|
long getTimestamp() override {
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ bool HWTSensorManager::begin() {
|
|||||||
|
|
||||||
bool HWTSensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) {
|
bool HWTSensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) {
|
||||||
if (requester_permissions & TELEM_PERM_LOCATION) { // does requester have permission?
|
if (requester_permissions & TELEM_PERM_LOCATION) { // does requester have permission?
|
||||||
telemetry.addGPS(TELEM_CHANNEL_SELF, node_lat, node_lon, 0.0f);
|
telemetry.addGPS(TELEM_CHANNEL_SELF, node_lat, node_lon, node_altitude);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -117,6 +117,7 @@ void HWTSensorManager::loop() {
|
|||||||
if (gps_active && _location->isValid()) {
|
if (gps_active && _location->isValid()) {
|
||||||
node_lat = ((double)_location->getLatitude())/1000000.;
|
node_lat = ((double)_location->getLatitude())/1000000.;
|
||||||
node_lon = ((double)_location->getLongitude())/1000000.;
|
node_lon = ((double)_location->getLongitude())/1000000.;
|
||||||
|
node_altitude = ((double)_location->getAltitude()) / 1000.0;
|
||||||
MESH_DEBUG_PRINTLN("lat %f lon %f", node_lat, node_lon);
|
MESH_DEBUG_PRINTLN("lat %f lon %f", node_lat, node_lon);
|
||||||
}
|
}
|
||||||
next_gps_update = millis() + 1000;
|
next_gps_update = millis() + 1000;
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ bool TbeamSupSensorManager::begin() {
|
|||||||
|
|
||||||
bool TbeamSupSensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) {
|
bool TbeamSupSensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) {
|
||||||
if (requester_permissions & TELEM_PERM_LOCATION) { // does requester have permission?
|
if (requester_permissions & TELEM_PERM_LOCATION) { // does requester have permission?
|
||||||
telemetry.addGPS(TELEM_CHANNEL_SELF, node_lat, node_lon, 0.0f);
|
telemetry.addGPS(TELEM_CHANNEL_SELF, node_lat, node_lon, node_altitude);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -301,6 +301,7 @@ void TbeamSupSensorManager::loop() {
|
|||||||
if (_nmea->isValid()) {
|
if (_nmea->isValid()) {
|
||||||
node_lat = ((double)_nmea->getLatitude())/1000000.;
|
node_lat = ((double)_nmea->getLatitude())/1000000.;
|
||||||
node_lon = ((double)_nmea->getLongitude())/1000000.;
|
node_lon = ((double)_nmea->getLongitude())/1000000.;
|
||||||
|
node_altitude = ((double)_nmea->getAltitude()) / 1000.0;
|
||||||
//Serial.printf("lat %f lon %f\r\n", _lat, _lon);
|
//Serial.printf("lat %f lon %f\r\n", _lat, _lon);
|
||||||
}
|
}
|
||||||
next_gps_update = millis() + 1000;
|
next_gps_update = millis() + 1000;
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ bool T1000SensorManager::begin() {
|
|||||||
|
|
||||||
bool T1000SensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) {
|
bool T1000SensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) {
|
||||||
if (requester_permissions & TELEM_PERM_LOCATION) { // does requester have permission?
|
if (requester_permissions & TELEM_PERM_LOCATION) { // does requester have permission?
|
||||||
telemetry.addGPS(TELEM_CHANNEL_SELF, node_lat, node_lon, 0.0f);
|
telemetry.addGPS(TELEM_CHANNEL_SELF, node_lat, node_lon, node_altitude);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -168,6 +168,7 @@ void T1000SensorManager::loop() {
|
|||||||
if (_nmea->isValid()) {
|
if (_nmea->isValid()) {
|
||||||
node_lat = ((double)_nmea->getLatitude())/1000000.;
|
node_lat = ((double)_nmea->getLatitude())/1000000.;
|
||||||
node_lon = ((double)_nmea->getLongitude())/1000000.;
|
node_lon = ((double)_nmea->getLongitude())/1000000.;
|
||||||
|
node_altitude = ((double)_nmea->getAltitude()) / 1000.0;
|
||||||
//Serial.printf("lat %f lon %f\r\n", _lat, _lon);
|
//Serial.printf("lat %f lon %f\r\n", _lat, _lon);
|
||||||
}
|
}
|
||||||
next_gps_update = millis() + 1000;
|
next_gps_update = millis() + 1000;
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ bool T114SensorManager::begin() {
|
|||||||
|
|
||||||
bool T114SensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) {
|
bool T114SensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) {
|
||||||
if (requester_permissions & TELEM_PERM_LOCATION) { // does requester have permission?
|
if (requester_permissions & TELEM_PERM_LOCATION) { // does requester have permission?
|
||||||
telemetry.addGPS(TELEM_CHANNEL_SELF, node_lat, node_lon, 0.0f);
|
telemetry.addGPS(TELEM_CHANNEL_SELF, node_lat, node_lon, node_altitude);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -125,6 +125,7 @@ void T114SensorManager::loop() {
|
|||||||
if (_location->isValid()) {
|
if (_location->isValid()) {
|
||||||
node_lat = ((double)_location->getLatitude())/1000000.;
|
node_lat = ((double)_location->getLatitude())/1000000.;
|
||||||
node_lon = ((double)_location->getLongitude())/1000000.;
|
node_lon = ((double)_location->getLongitude())/1000000.;
|
||||||
|
node_altitude = ((double)_location->getAltitude()) / 1000.0;
|
||||||
MESH_DEBUG_PRINTLN("lat %f lon %f", node_lat, node_lon);
|
MESH_DEBUG_PRINTLN("lat %f lon %f", node_lat, node_lon);
|
||||||
}
|
}
|
||||||
next_gps_update = millis() + 1000;
|
next_gps_update = millis() + 1000;
|
||||||
|
|||||||
Reference in New Issue
Block a user