65 #define frac(f) (f - (int)f) 87 if (s_port_subscription_data ==
nullptr) {
96 if (s_port_subscription_data) {
98 s_port_subscription_data =
nullptr;
125 const uint8_t x7E[] = { 0x7D, 0x5E };
126 const uint8_t x7D[] = { 0x7D, 0x5D };
130 write(uart, x7E,
sizeof(x7E));
134 write(uart, x7D,
sizeof(x7D));
138 write(uart, &value,
sizeof(value));
154 const uint8_t c = 0x10;
162 for (
int i = 0; i < 2; i++) {
169 for (
int i = 0; i < 4; i++) {
211 uint32_t ispeed = (int)(10 * speed);
219 int32_t ispeed = (int)(100 * speed);
270 if (iYaw < 0) { iYaw += 36000; }
281 struct tm *tm_gps = gmtime(&time_gps);
286 (uint32_t) 0xff | (tm_gps->tm_mday << 8) | ((tm_gps->tm_mon + 1) << 16) | ((tm_gps->tm_year - 100) << 24));
292 (uint32_t) 0x00 | (tm_gps->tm_sec << 8) | (tm_gps->tm_min << 16) | (tm_gps->tm_hour << 24));
304 uint32_t ispeed = (int)(1944 * speed);
326 uint32_t
t2 = satcount * 10 + fixtype;
uint16_t get_telemetry_flight_mode(int px4_flight_mode)
Map the PX4 flight mode (vehicle_status_s::nav_state) to the telemetry flight mode.
static struct s_port_subscription_data_s * s_port_subscription_data
void sPort_send_GPS_ALT(int uart)
Definition of geo / math functions to perform geodesic calculations.
#define SMARTPORT_ID_FUEL
uORB::SubscriptionData< vehicle_global_position_s > vehicle_global_position_sub
void sPort_send_GPS_TIME(int uart)
void sPort_send_SPD(int uart)
void sPort_send_ALT(int uart)
void sPort_send_FUEL(int uart)
High-resolution timer with callouts and timekeeping.
#define SMARTPORT_ID_GPS_LON_LAT
uORB::SubscriptionData< battery_status_s > battery_status_sub
#define SMARTPORT_ID_GPS_SPD
#define SMARTPORT_ID_GPS_ALT
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic.
#define SMARTPORT_ID_VARIO
uORB::SubscriptionData< vehicle_air_data_s > vehicle_air_data_sub
static void update_crc(uint16_t *crc, unsigned char b)
#define SMARTPORT_ID_VFAS
#define SMARTPORT_ID_DIY_NAVSTATE
uORB::SubscriptionData< sensor_combined_s > sensor_combined_sub
void sPort_send_data(int uart, uint16_t id, uint32_t data)
Sends one data id/value pair.
void sPort_send_VSPD(int uart, float speed)
uORB::SubscriptionData< vehicle_status_s > vehicle_status_sub
void sPort_update_topics()
void sPort_send_NAV_STATE(int uart)
void sPort_send_GPS_info(int uart)
static void write(bootloader_app_shared_t *pshared)
#define SMARTPORT_ID_GPS_CRS
void sPort_send_flight_mode(int uart)
void sPort_send_GPS_CRS(int uart)
void sPort_send_GPS_LON(int uart)
void sPort_send_GPS_FIX(int uart)
void sPort_send_CUR(int uart)
#define SMARTPORT_ID_CURR
void sPort_send_GPS_SPD(int uart)
void sPort_send_BATV(int uart)
void sPort_send_GPS_LAT(int uart)
uORB::SubscriptionData< vehicle_local_position_s > vehicle_local_position_sub
#define SMARTPORT_ID_DIY_GPSFIX
bool sPort_init()
Initializes the uORB subscriptions.
#define SMARTPORT_ID_GPS_TIME
static void sPort_send_byte(int uart, uint8_t value)
Sends one byte, performing byte-stuffing if necessary.
uORB::SubscriptionData< vehicle_gps_position_s > vehicle_gps_position_sub