mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-26 15:54:15 +01:00
OP-1370 - Show AutoConfig status in GPSPositionSensor
This commit is contained in:
parent
69b76b665c
commit
c4d5234ee6
@ -257,8 +257,15 @@ static void gpsTask(__attribute__((unused)) void *parameters)
|
||||
break;
|
||||
#endif
|
||||
#if defined(PIOS_INCLUDE_GPS_UBX_PARSER)
|
||||
case GPSSETTINGS_DATAPROTOCOL_UBX:
|
||||
res = parse_ubx_stream(c, gps_rx_buffer, &gpspositionsensor, &gpsRxStats);
|
||||
case GPSSETTINGS_DATAPROTOCOL_UBX:{
|
||||
int32_t ac_status = ubx_autoconfig_get_status();
|
||||
gpspositionsensor.AutoConfigStatus =
|
||||
ac_status == UBX_AUTOCONFIG_STATUS_DISABLED ? GPSPOSITIONSENSOR_AUTOCONFIGSTATUS_DISABLED :
|
||||
ac_status == UBX_AUTOCONFIG_STATUS_DONE ? GPSPOSITIONSENSOR_AUTOCONFIGSTATUS_DONE :
|
||||
ac_status == UBX_AUTOCONFIG_STATUS_ERROR? GPSPOSITIONSENSOR_AUTOCONFIGSTATUS_ERROR :
|
||||
GPSPOSITIONSENSOR_AUTOCONFIGSTATUS_RUNNING;
|
||||
res = parse_ubx_stream(c, gps_rx_buffer, &gpspositionsensor, &gpsRxStats);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@ -39,6 +39,13 @@
|
||||
#define UBX_REPLY_TIMEOUT (500 * 1000)
|
||||
#define UBX_MAX_RETRIES 5
|
||||
|
||||
// types
|
||||
typedef enum {
|
||||
UBX_AUTOCONFIG_STATUS_DISABLED = 0,
|
||||
UBX_AUTOCONFIG_STATUS_RUNNING,
|
||||
UBX_AUTOCONFIG_STATUS_DONE,
|
||||
UBX_AUTOCONFIG_STATUS_ERROR
|
||||
} ubx_autoconfig_status_t;
|
||||
// Enumeration options for field UBXDynamicModel
|
||||
typedef enum {
|
||||
UBX_DYNMODEL_PORTABLE = 0,
|
||||
@ -114,5 +121,5 @@ typedef union {
|
||||
|
||||
void ubx_autoconfig_run(char * *buffer, uint16_t *bytes_to_send);
|
||||
void ubx_autoconfig_set(ubx_autoconfig_settings_t config);
|
||||
|
||||
int32_t ubx_autoconfig_get_status();
|
||||
#endif /* UBX_AUTOCONFIG_H_ */
|
||||
|
@ -51,7 +51,7 @@ typedef struct {
|
||||
int8_t lastConfigSent; // index of last configuration string sent
|
||||
struct UBX_ACK_ACK requiredAck; // Class and id of the message we are waiting for an ACK from GPS
|
||||
uint8_t retryCount;
|
||||
} ubx_autoconfig_status_t;
|
||||
} status_t;
|
||||
|
||||
ubx_cfg_msg_t msg_config_ubx6[] = {
|
||||
{ .msgClass = UBX_CLASS_NAV, .msgID = UBX_ID_NAV_POSLLH, .rate = 1 },
|
||||
@ -82,7 +82,7 @@ ubx_cfg_msg_t msg_config_ubx7[] = {
|
||||
// enable the autoconfiguration system
|
||||
static bool enabled;
|
||||
|
||||
static ubx_autoconfig_status_t *status = 0;
|
||||
static status_t *status = 0;
|
||||
|
||||
static void append_checksum(UBXSentPacket_t *packet)
|
||||
{
|
||||
@ -278,8 +278,8 @@ void ubx_autoconfig_set(ubx_autoconfig_settings_t config)
|
||||
enabled = false;
|
||||
if (config.autoconfigEnabled) {
|
||||
if (!status) {
|
||||
status = (ubx_autoconfig_status_t *)pios_malloc(sizeof(ubx_autoconfig_status_t));
|
||||
memset(status, 0, sizeof(ubx_autoconfig_status_t));
|
||||
status = (status_t *)pios_malloc(sizeof(status_t));
|
||||
memset(status, 0, sizeof(status_t));
|
||||
status->currentStep = INIT_STEP_DISABLED;
|
||||
}
|
||||
status->currentSettings = config;
|
||||
@ -287,3 +287,21 @@ void ubx_autoconfig_set(ubx_autoconfig_settings_t config)
|
||||
enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t ubx_autoconfig_get_status(){
|
||||
if(!status){
|
||||
return UBX_AUTOCONFIG_STATUS_DISABLED;
|
||||
}
|
||||
switch (status->currentStep) {
|
||||
case INIT_STEP_ERROR:
|
||||
return UBX_AUTOCONFIG_STATUS_ERROR;
|
||||
case INIT_STEP_DISABLED:
|
||||
return UBX_AUTOCONFIG_STATUS_DISABLED;
|
||||
case INIT_STEP_DONE:
|
||||
return UBX_AUTOCONFIG_STATUS_DONE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return UBX_AUTOCONFIG_STATUS_RUNNING;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
<field name="HDOP" units="" type="float" elements="1"/>
|
||||
<field name="VDOP" units="" type="float" elements="1"/>
|
||||
<field name="SensorType" units="" type="enum" elements="1" options="Unknown,NMEA,UBX,UBX7,UBX8" defaultvalue="Unknown" />
|
||||
<field name="AutoConfigStatus" units="" type="enum" elements="1" options="DISABLED,RUNNING,DONE,ERROR" defaultvalue="DISABLED" />
|
||||
<access gcs="readwrite" flight="readwrite"/>
|
||||
<telemetrygcs acked="false" updatemode="manual" period="0"/>
|
||||
<telemetryflight acked="false" updatemode="periodic" period="1000"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user