extended pressure resolution to proper .1 of hPa

pull/2/head DE03
Mateusz Lubecki 2019-10-30 22:16:27 +01:00
rodzic 0fd739da99
commit 02dca8eb39
4 zmienionych plików z 16 dodań i 9 usunięć

Wyświetl plik

@ -3,8 +3,8 @@
#include "aprs/ax25.h"
#define SW_VER "DE02"
#define SW_DATE "11092019"
#define SW_VER "DE03"
#define SW_DATE "30102019"
#define SYSTICK_TICKS_PER_SECONDS 100
#define SYSTICK_TICKS_PERIOD 10

Wyświetl plik

@ -59,7 +59,7 @@ void packet_tx_handler(void) {
// _DALLAS_AS_TELEM wil be set during compilation wx packets will be filled by temperature from MS5611 sensor
SendWXFrame(&VNAME, rte_wx_temperature_valid, rte_wx_pressure_valid);
#else
SendWXFrame(&VNAME, rte_wx_temperature_dallas_valid, rte_wx_pressure_valid);
SendWXFrame(&VNAME, rte_wx_temperature_average_dallas_valid, rte_wx_pressure_valid);
#endif
main_wait_for_tx_complete();

Wyświetl plik

@ -11,8 +11,8 @@
#include "drivers/tx20.h"
#include <stdint.h>
void SendWXFrame(Anemometer* input, float temperatura, unsigned cisnienie);
void SendWXFrameToBuffer(Anemometer* input, float temperatura, unsigned cisnienie, uint8_t* buffer, uint16_t buffer_ln, uint16_t* output_ln);
void SendWXFrame(Anemometer* input, float temperatura, float cisnienie);
void SendWXFrameToBuffer(Anemometer* input, float temperatura, float cisnienie, uint8_t* buffer, uint16_t buffer_ln, uint16_t* output_ln);
#endif /* INCLUDE_APRS_WX_H_ */

Wyświetl plik

@ -13,9 +13,10 @@
#include "station_config.h"
void SendWXFrame(Anemometer* input, float temperatura, unsigned cisnienie) {
void SendWXFrame(Anemometer* input, float temperatura, float cisnienie) {
float max_wind_speed = 0.0f, temp = 0.0f;
unsigned char wind_speed_mph = 0, wind_gusts_mph = 0, d = 0;
unsigned pressure = 0;
for(d = 1; d <= TX20_BUFF_LN - 1 ; d++)
if (VNAME.HistoryAVG[d].WindSpeed > max_wind_speed)
max_wind_speed = VNAME.HistoryAVG[d].WindSpeed; // Wyszukiwane najwiekszej wartosci
@ -41,7 +42,9 @@ void SendWXFrame(Anemometer* input, float temperatura, unsigned cisnienie) {
rte_main_reboot_req = 1;
}
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, "!%07.2f%c%c%08.2f%c%c%03d/%03dg%03dt%03dr...p...P...b%05d", _LAT, _LATNS, '/', _LON, _LONWE, '_', /* kierunek */(short)(input->HistoryAVG[0].WindDirX), /* predkosc*/(int)wind_speed_mph, /* porywy */(short)(wind_gusts_mph), /*temperatura */(short)(temperatura*1.8+32), cisnienie *10);
pressure = (unsigned)(cisnienie * 10);
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, "!%07.2f%c%c%08.2f%c%c%03d/%03dg%03dt%03dr...p...P...b%05d", _LAT, _LATNS, '/', _LON, _LONWE, '_', /* kierunek */(short)(input->HistoryAVG[0].WindDirX), /* predkosc*/(int)wind_speed_mph, /* porywy */(short)(wind_gusts_mph), /*temperatura */(short)(temperatura*1.8+32), pressure);
main_own_aprs_msg[main_own_aprs_msg_len] = 0;
ax25_sendVia(&main_ax25, main_own_path, main_own_path_ln, main_own_aprs_msg, main_own_aprs_msg_len);
after_tx_lock = 1;
@ -51,11 +54,12 @@ void SendWXFrame(Anemometer* input, float temperatura, unsigned cisnienie) {
}
void SendWXFrameToBuffer(Anemometer* input, float temperatura, unsigned cisnienie, uint8_t* buffer, uint16_t buffer_ln, uint16_t* output_ln) {
void SendWXFrameToBuffer(Anemometer* input, float temperatura, float cisnienie, uint8_t* buffer, uint16_t buffer_ln, uint16_t* output_ln) {
uint16_t output_frame_ln = 0;
float max_wind_speed = 0.0f, temp = 0.0f;
unsigned char wind_speed_mph = 0, wind_gusts_mph = 0, d = 0;
unsigned pressure = 0;
for(d = 1; d <= TX20_BUFF_LN - 1 ; d++)
if (VNAME.HistoryAVG[d].WindSpeed > max_wind_speed)
max_wind_speed = VNAME.HistoryAVG[d].WindSpeed; // Wyszukiwane najwiekszej wartosci
@ -75,7 +79,10 @@ void SendWXFrameToBuffer(Anemometer* input, float temperatura, unsigned cisnieni
wind_gusts_mph = (short)max_wind_speed + 1;
else
wind_gusts_mph = (short)max_wind_speed;
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, "!%07.2f%c%c%08.2f%c%c%03d/%03dg%03dt%03dr...p...P...b%05d", _LAT, _LATNS, '/', _LON, _LONWE, '_', /* kierunek */(short)(input->HistoryAVG[0].WindDirX), /* predkosc*/(int)wind_speed_mph, /* porywy */(short)(wind_gusts_mph), /*temperatura */(short)(temperatura*1.8+32), cisnienie *10);
pressure = (unsigned)(cisnienie * 10);
main_own_aprs_msg_len = sprintf(main_own_aprs_msg, "!%07.2f%c%c%08.2f%c%c%03d/%03dg%03dt%03dr...p...P...b%05d", _LAT, _LATNS, '/', _LON, _LONWE, '_', /* kierunek */(short)(input->HistoryAVG[0].WindDirX), /* predkosc*/(int)wind_speed_mph, /* porywy */(short)(wind_gusts_mph), /*temperatura */(short)(temperatura*1.8+32), pressure);
// aprs_msg_len = sprintf(aprs_msg, "%s%03d/%03dg%03dt%03dr%03dp%03dP%03db%04d ~", "!5001.45N/02159.66E_", /* kierunek */90, /* predkosc*/(int)(2.1 * 2.23698), /* porywy */(short)(5.7 * 2.23698), /*temperatura */(short)(23 * 1.8 + 32), 0, 0, 0, 10130);
main_own_aprs_msg[main_own_aprs_msg_len] = 0;