Files
@ 645e46f4898d
Branch filter:
Location: windsonde/Libraries/aprs/aprs.c - annotation
645e46f4898d
3.3 KiB
text/plain
Update scale for bme280 to tenths of percent, disable lps25h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be f2c57ce0cd7b f2c57ce0cd7b f2c57ce0cd7b f2c57ce0cd7b f2c57ce0cd7b 0f04af7169be 7ff1c5a59571 0f04af7169be 0f04af7169be 0f04af7169be 67d1f9d02048 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 7ff1c5a59571 55d6f1467ce4 55d6f1467ce4 55d6f1467ce4 55d6f1467ce4 55d6f1467ce4 55d6f1467ce4 55d6f1467ce4 55d6f1467ce4 55d6f1467ce4 55d6f1467ce4 7ff1c5a59571 a675e30661bd a675e30661bd 7ff1c5a59571 0f04af7169be a675e30661bd a675e30661bd a675e30661bd a675e30661bd a675e30661bd a675e30661bd a675e30661bd 0f04af7169be a675e30661bd a675e30661bd a675e30661bd 0f04af7169be f2c57ce0cd7b f2c57ce0cd7b a675e30661bd f2c57ce0cd7b a675e30661bd 0f04af7169be a675e30661bd 55ef914749dc 55ef914749dc 55ef914749dc 55ef914749dc f2c57ce0cd7b f2c57ce0cd7b f2c57ce0cd7b f2c57ce0cd7b f2c57ce0cd7b f2c57ce0cd7b f2c57ce0cd7b f2c57ce0cd7b f2c57ce0cd7b f2c57ce0cd7b f2c57ce0cd7b f2c57ce0cd7b f2c57ce0cd7b 55ef914749dc a675e30661bd f2c57ce0cd7b a675e30661bd a675e30661bd 7ff1c5a59571 7ff1c5a59571 0f04af7169be 041562172b4a 041562172b4a 041562172b4a 041562172b4a 67d1f9d02048 67d1f9d02048 67d1f9d02048 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be 0f04af7169be | /*
* FeatherHAB
*
* This file is part of FeatherHAB.
*
* FeatherHab is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FeatherHab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with FeatherHAB. If not, see <http://www.gnu.org/licenses/>.
*
* Ethan Zonca
*
*/
#include <string.h>
#include <stdlib.h>
#include "config.h"
#ifdef LPS25H
#include "lps25h.h"
#else
#include "bme280.h"
#endif
#include "aprs.h"
#include "gps.h"
//#include "gps.h"
//#include "adc.h"
#include "ax25.h"
#include "system/adc.h"
int32_t meters_to_feet(int32_t m)
{
// 10000 ft = 3048 m
return (float)m / 0.3048;
}
void aprs_send(void)
{
struct s_address addresses[] = {
{D_CALLSIGN, D_CALLSIGN_ID}, // Destination callsign
{"", S_CALLSIGN_ID}, // Source callsign (-11 = balloon, -9 = car)
//{S_CALLSIGN, S_CALLSIGN_ID},
#ifdef DIGI_PATH1
{DIGI_PATH1, DIGI_PATH1_TTL}, // Digi1 (first digi in the chain)
#endif
#ifdef DIGI_PATH2
{DIGI_PATH2, DIGI_PATH2_TTL}, // Digi2 (second digi in the chain)
#endif
};
strncpy(addresses[1].callsign, S_CALLSIGN, 7);
// emz: modified this to get the size of the first address rather than the size of the struct itself, which fails
ax25_send_header(addresses, sizeof(addresses)/sizeof(addresses[0]));
char tmpBuffer[128];
#ifdef FRIENDLY_MODE
if(HAL_GetTick() > 1000 * FRIENDLY_TIMEOUT)
{
snprintf(tmpBuffer, 128, "KD8TDF");
ax25_send_string(tmpBuffer);
}
#endif
ax25_send_byte(',');
// Latitude
snprintf(tmpBuffer, 128, "%ld,", gps_getdata()->latitude);
ax25_send_string(tmpBuffer);
// Longitude
snprintf(tmpBuffer, 128, "%ld,", gps_getdata()->longitude);
ax25_send_string(tmpBuffer);
// Speed
snprintf(tmpBuffer, 128, "%d,", gps_getdata()->speed);
ax25_send_string(tmpBuffer);
// Altitude
snprintf(tmpBuffer, 128, "%d,", gps_getdata()->altitude);
ax25_send_string(tmpBuffer);
#ifdef LPS25H
// Pressure
snprintf(tmpBuffer, 128, "%d,", lps25h_get_pressure());
ax25_send_string(tmpBuffer);
// Temperature
snprintf(tmpBuffer, 128, "%d,", bme280_get_temperature());
ax25_send_string(tmpBuffer);
// Humidity
snprintf(tmpBuffer, 128, "0,");
ax25_send_string(tmpBuffer);
#else
// Pressure
snprintf(tmpBuffer, 128, "%d,", bme280_get_pressure());
ax25_send_string(tmpBuffer);
// Temperature
snprintf(tmpBuffer, 128, "%d,", bme280_get_temperature());
ax25_send_string(tmpBuffer);
// Humidity
snprintf(tmpBuffer, 128, "%d,", bme280_get_humidity());
ax25_send_string(tmpBuffer);
#endif
// HDOP
snprintf(tmpBuffer, 128, "%u,", gps_getdata()->pdop);
ax25_send_string(tmpBuffer);
// Heading
snprintf(tmpBuffer, 128, "%u,", gps_getdata()->heading);
ax25_send_string(tmpBuffer);
// Vbatt
snprintf(tmpBuffer, 128, "%u,", adc_get_vbatt());
ax25_send_string(tmpBuffer);
ax25_send_footer();
ax25_flush_frame();
}
// vim:softtabstop=4 shiftwidth=4 expandtab
|