Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[esp_modem]: Accept some PRs #531

Merged
merged 3 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions components/esp_modem/examples/pppos_client/main/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,6 @@ menu "Example Configuration"
help
Set APN (Access Point Name), a logical name to choose data network

config EXAMPLE_MODEM_PPP_AUTH_USERNAME
string "Set username for authentication"
default "espressif"
depends on !EXAMPLE_MODEM_PPP_AUTH_NONE
help
Set username for PPP Authentication.

config EXAMPLE_MODEM_PPP_AUTH_PASSWORD
string "Set password for authentication"
default "esp32"
depends on !EXAMPLE_MODEM_PPP_AUTH_NONE
help
Set password for PPP Authentication.

config EXAMPLE_MODEM_PPP_AUTH_NONE
bool "Skip PPP authentication"
default n
help
Set to true for the PPP client to skip authentication

config EXAMPLE_SEND_MSG
bool "Short message (SMS)"
default n
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ std::unique_ptr<DCE_gnss> create_SIM7070_GNSS_dce(const esp_modem::dce_config *c
return gnss_factory::LocalFactory::create(config, std::move(dte), netif);
}

esp_modem::command_result get_gnss_information_sim70xx_lib(esp_modem::CommandableIf *t, esp_modem_gps_t &gps)
esp_modem::command_result get_gnss_information_sim70xx_lib(esp_modem::CommandableIf *t, sim70xx_gps_t &gps)
{

ESP_LOGV(TAG, "%s", __func__ );
Expand All @@ -67,24 +67,26 @@ esp_modem::command_result get_gnss_information_sim70xx_lib(esp_modem::Commandabl
}
/**
* Parsing +CGNSINF:
* <GNSS run status>,
* <Fix status>,
* <UTC date & Time>,
* <Latitude>,
* <Longitude>,
* <MSL Altitude>,
* <Speed Over Ground>,
* <Course Over Ground>,
* <Fix Mode>,
* <Reserved1>,
* <HDOP>,
* <PDOP>,
* <VDOP>,
* <Reserved2>,
* <GNSS Satellites in View>,
* <Reserved3>,
* <HPA>,
* <VPA>
| **Index** | **Parameter** | **Unit** | **Range** | **Length** |
|-----------|------------------------|--------------------|--------------------------------------------------------------------------------------|------------|
| 1 | GNSS run status | -- | 0-1 | 1 |
| 2 | Fix status | -- | 0-1 | 1 |
| 3 | UTC date & Time | yyyyMMddhhmmss.sss | yyyy: [1980,2039] MM : [1,12] dd: [1,31] hh: [0,23] mm: [0,59] ss.sss:[0.000,60.999] | 18 |
| 4 | Latitude | ±dd.dddddd | [-90.000000,90.000000] | 10 |
| 5 | Longitude | ±dd.dddddd | -180.000000,180.000000] | 11 |
| 6 | MSL Altitude | meters | [0,999.99] | 8 |
| 7 | Speed Over Ground | Km/hour | [0,360.00] | 6 |
| 8 | Course Over Ground | degrees | 0,1,2[1] | 6 |
| 9 | Fix Mode | -- | | 1 |
| 10 | Reserved1 | | | 0 |
| 11 | HDOP | -- | [0,99.9] | 4 |
| 12 | PDOP | -- | [0,99.9] | 4 |
| 13 | VDOP | -- | [0,99.9] | 4 |
| 14 | Reserved2 | | | 0 |
| 15 | GPS Satellites in View | -- | -- [0,99] | 2 |
| 16 | Reserved3 | | | 0 |
| 17 | HPA[2] | meters | [0,9999.9] | 6 |
| 18 | VPA[2] | meters | [0,9999.9] | 6 |
*/
out = out.substr(pattern.size());
int pos = 0;
Expand Down Expand Up @@ -291,11 +293,11 @@ esp_modem::command_result get_gnss_information_sim70xx_lib(esp_modem::Commandabl
{
std::string_view sats_in_view = out.substr(0, pos);
if (sats_in_view.length() > 1) {
if (std::from_chars(out.data(), out.data() + pos, gps.sats_in_view).ec == std::errc::invalid_argument) {
if (std::from_chars(out.data(), out.data() + pos, gps.sat.num).ec == std::errc::invalid_argument) {
return esp_modem::command_result::FAIL;
}
} else {
gps.sats_in_view = 0;
gps.sat.num = 0;
}
} //clean up sats_in_view

Expand Down Expand Up @@ -330,12 +332,12 @@ esp_modem::command_result get_gnss_information_sim70xx_lib(esp_modem::Commandabl
return esp_modem::command_result::OK;
}

esp_modem::command_result SIM7070_gnss::get_gnss_information_sim70xx(esp_modem_gps_t &gps)
esp_modem::command_result SIM7070_gnss::get_gnss_information_sim70xx(sim70xx_gps_t &gps)
{
return get_gnss_information_sim70xx_lib(dte.get(), gps);
}

esp_modem::command_result DCE_gnss::get_gnss_information_sim70xx(esp_modem_gps_t &gps)
esp_modem::command_result DCE_gnss::get_gnss_information_sim70xx(sim70xx_gps_t &gps)
{
return device->get_gnss_information_sim70xx(gps);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include "cxx_include/esp_modem_dce_factory.hpp"
#include "cxx_include/esp_modem_dce_module.hpp"
#include "nmea_parser.h"
#include "sim70xx_gps.h"

/**
* @brief Definition of a custom SIM7070 class with GNSS capabilities.
Expand All @@ -23,7 +23,7 @@
class SIM7070_gnss: public esp_modem::SIM7070 {
using SIM7070::SIM7070;
public:
esp_modem::command_result get_gnss_information_sim70xx(esp_modem_gps_t &gps);
esp_modem::command_result get_gnss_information_sim70xx(sim70xx_gps_t &gps);
};

/**
Expand All @@ -47,7 +47,7 @@ class DCE_gnss : public esp_modem::DCE_T<SIM7070_gnss> {

#undef ESP_MODEM_DECLARE_DCE_COMMAND

esp_modem::command_result get_gnss_information_sim70xx(esp_modem_gps_t &gps);
esp_modem::command_result get_gnss_information_sim70xx(sim70xx_gps_t &gps);

};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ extern "C" {
#define GPS_MAX_SATELLITES_IN_VIEW (16)



/**
* @brief GPS fix type
*
Expand Down Expand Up @@ -53,9 +52,6 @@ typedef enum {
*/
typedef struct {
uint8_t num; /*!< Satellite number */
uint8_t elevation; /*!< Satellite elevation */
uint16_t azimuth; /*!< Satellite azimuth */
uint8_t snr; /*!< Satellite signal noise ratio */
} gps_satellite_t;

/**
Expand All @@ -79,54 +75,31 @@ typedef struct {
uint16_t year; /*!< Year (start from 2000) */
} gps_date_t;

/**
* @brief NMEA Statement
*
*/
typedef enum {
STATEMENT_UNKNOWN = 0, /*!< Unknown statement */
STATEMENT_GGA, /*!< GGA */
STATEMENT_GSA, /*!< GSA */
STATEMENT_RMC, /*!< RMC */
STATEMENT_GSV, /*!< GSV */
STATEMENT_GLL, /*!< GLL */
STATEMENT_VTG /*!< VTG */
} nmea_statement_t;

/**
* @brief GPS object
*
*/
struct esp_modem_gps {
float latitude; /*!< Latitude (degrees) */
float longitude; /*!< Longitude (degrees) */
float altitude; /*!< Altitude (meters) */
struct sim70xx_gps {
gps_run_t run; /*!< run status */
gps_fix_t fix; /*!< Fix status */
uint8_t sats_in_use; /*!< Number of satellites in use */
gps_date_t date; /*!< Fix date */
gps_time_t tim; /*!< time in UTC */
float latitude; /*!< Latitude (degrees) */
float longitude; /*!< Longitude (degrees) */
float altitude; /*!< Altitude (meters) */
float speed; /*!< Ground speed, unit: m/s */
float cog; /*!< Course over ground */
gps_fix_mode_t fix_mode; /*!< Fix mode */
float dop_h; /*!< Horizontal dilution of precision */
float dop_p; /*!< Position dilution of precision */
float dop_v; /*!< Vertical dilution of precision */
uint8_t sats_in_view; /*!< Number of satellites in view */
gps_date_t date; /*!< Fix date */
float speed; /*!< Ground speed, unit: m/s */
float cog; /*!< Course over ground */
gps_satellite_t sat; /*!< Number of satellites in view */
float hpa; /*!< Horizontal Position Accuracy */
float vpa; /*!< Vertical Position Accuracy */
};

typedef struct esp_modem_gps esp_modem_gps_t;
typedef struct sim70xx_gps sim70xx_gps_t;

/**
* @brief NMEA Parser Event ID
*
*/
typedef enum {
GPS_UPDATE, /*!< GPS information has been updated */
GPS_UNKNOWN /*!< Unknown statements detected */
} nmea_event_id_t;

#ifdef __cplusplus
}
Expand Down
Loading