Radiosonde-CRC-checkbox

Added CRC calculation for Vaisala radiosondes.

Added a Checkbox on APP for turning ON / OFF CRC. When CRC on, malformed packets are ignored.

Connected existing CRC function for METEOMAN sondes, using the same "CRC" checkbox logic.
This commit is contained in:
euquiq 2020-08-20 15:22:11 -03:00
parent c626d83c3b
commit e76a464f7e
4 changed files with 176 additions and 74 deletions

View file

@ -46,6 +46,7 @@ SondeView::SondeView(NavigationView& nav) {
&field_vga,
&rssi,
&check_log,
&check_crc,
&text_signature,
&text_serial,
&text_voltage,
@ -73,6 +74,10 @@ SondeView::SondeView(NavigationView& nav) {
check_log.on_select = [this](Checkbox&, bool v) {
logging = v;
};
check_crc.on_select = [this](Checkbox&, bool v) {
use_crc = v;
};
radio::enable({
tuning_frequency(),
@ -110,8 +115,10 @@ void SondeView::focus() {
}
void SondeView::on_packet(const sonde::Packet& packet) {
//const auto hex_formatted = packet.symbols_formatted();
if (use_crc && !packet.crc_ok()) //euquiq: Reject bad packet if crc is on
return;
text_signature.set(packet.type_string());
sonde_id = packet.serial_number(); //used also as tag on the geomap
text_serial.set(sonde_id);
@ -126,9 +133,6 @@ void SondeView::on_packet(const sonde::Packet& packet) {
if (logger && logging) {
logger->on_packet(packet);
}
/*if( packet.crc_ok() ) {
}*/
}
void SondeView::set_target_frequency(const uint32_t new_value) {

View file

@ -67,6 +67,7 @@ private:
std::unique_ptr<SondeLogger> logger { };
uint32_t target_frequency_ { 402700000 };
bool logging { false };
bool use_crc { false };
sonde::GPS_data gps_info;
std::string sonde_id;
@ -101,6 +102,12 @@ private:
"Log"
};
Checkbox check_crc {
{ 22 * 8, 5 * 16 },
3,
"CRC"
};
Text text_signature {
{ 10 * 8, 2 * 16, 10 * 8, 16 },
"..."
@ -115,12 +122,12 @@ private:
};
GeoPos geopos {
{ 0, 6 * 16 },
{ 0, 7 * 16 },
GeoPos::alt_unit::METERS
};
Button button_see_map {
{ 8 * 8, 10 * 16, 14 * 8, 3 * 16 },
{ 8 * 8, 11 * 16, 14 * 8, 3 * 16 },
"See on map"
};