From 98c3a50e815ed4b3230ab4afec1c679251566c3b Mon Sep 17 00:00:00 2001 From: Cameron Goddard Date: Fri, 1 Mar 2024 17:06:11 -0500 Subject: [PATCH] transmit altitude in 10s of meters --- src/ControlTasks/RadioControlTask.cpp | 2 +- src/constants.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ControlTasks/RadioControlTask.cpp b/src/ControlTasks/RadioControlTask.cpp index 908a386..aa91f24 100644 --- a/src/ControlTasks/RadioControlTask.cpp +++ b/src/ControlTasks/RadioControlTask.cpp @@ -261,7 +261,7 @@ bool RadioControlTask::executeDownlink() { uint16_t lat = round(map(sfr::gps::latitude, constants::gps::lat_min, constants::gps::lat_max, 0, 65536)); uint16_t lon = round(map(sfr::gps::longitude, constants::gps::lon_min, constants::gps::lon_max, 0, 65536)); - uint16_t alt = round(map(sfr::gps::altitude, constants::gps::alt_min, constants::gps::alt_max, 0, 65536)); + uint16_t alt = round(map(sfr::gps::altitude / 10, constants::gps::alt_min, constants::gps::alt_max, 0, 65536)); uint8_t flags = ((sfr::radio::mode == radio_mode_type::listen) ? 0xF0 : 0x00) | (sfr::gps::valid_msg ? 0x0F : 0x00); diff --git a/src/constants.hpp b/src/constants.hpp index 5b93385..a7f3a5a 100644 --- a/src/constants.hpp +++ b/src/constants.hpp @@ -45,7 +45,7 @@ namespace constants { constexpr int lon_min = -18000; constexpr int lon_max = 18000; constexpr int alt_min = 0; - constexpr int32_t alt_max = 500000; + constexpr int alt_max = 50000; // In 10's of meters } // namespace gps namespace opcodes { constexpr int no_op = 0x00;