Skip to content

Commit

Permalink
Merge pull request #932 from joyel24/meteomodem-M20-radiosondes
Browse files Browse the repository at this point in the history
Identifying meteomodem m20 radiosondes & extract GNSS location
  • Loading branch information
gullradriel committed Apr 30, 2023
2 parents cb93f26 + e8b8f0c commit c5579e2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions firmware/common/sonde_packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ Packet::Packet(
type_ = Type::Meteomodem_M10;
else if (id_byte == 0x648F)
type_ = Type::Meteomodem_M2K2;
else if (id_byte == 0x4520) //https://raw.githubusercontent.com/projecthorus/radiosonde_auto_rx/master/demod/mod/m20mod.c
type_ = Type::Meteomodem_M20;
}
}

Expand Down Expand Up @@ -109,6 +111,12 @@ GPS_data Packet::get_GPS_data() const
result.lat = reader_bi_m.read(14 * 8, 32) / ((1ULL << 32) / 360.0);
result.lon = reader_bi_m.read(18 * 8, 32) / ((1ULL << 32) / 360.0);
}
else if (type_ == Type::Meteomodem_M20)
{
result.alt = 0; //((reader_bi_m.read(8 * 8, 32) / 100) - 48) / 250 ; //Disable innacurate altitude for the moment.
result.lat = reader_bi_m.read(28 * 8, 32) / 1000000.0 ; //https://raw.githubusercontent.com/projecthorus/radiosonde_auto_rx/master/demod/mod/m20mod.c
result.lon = reader_bi_m.read(32 * 8, 32) / 1000000.0 ;
}
else if (type_ == Type::Vaisala_RS41_SG)
{

Expand Down Expand Up @@ -147,6 +155,10 @@ uint32_t Packet::battery_voltage() const
{
if (type_ == Type::Meteomodem_M10)
return (reader_bi_m.read(69 * 8, 8) + (reader_bi_m.read(70 * 8, 8) << 8)) * 1000 / 150;
else if (type_ == Type::Meteomodem_M20)
{
return 0; //NOT SUPPPORTED YET
}
else if (type_ == Type::Meteomodem_M2K2)
return reader_bi_m.read(69 * 8, 8) * 66; // Actually 65.8
else if (type_ == Type::Vaisala_RS41_SG)
Expand Down Expand Up @@ -279,6 +291,8 @@ std::string Packet::type_string() const
return "Meteomodem ???";
case Type::Meteomodem_M10:
return "Meteomodem M10";
case Type::Meteomodem_M20:
return "Meteomodem M20";
case Type::Meteomodem_M2K2:
return "Meteomodem M2K2";
case Type::Vaisala_RS41_SG:
Expand Down
1 change: 1 addition & 0 deletions firmware/common/sonde_packet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Packet {
Meteomodem_M10 = 2,
Meteomodem_M2K2 = 3,
Vaisala_RS41_SG = 4,
Meteomodem_M20 = 5,
};

Packet(const baseband::Packet& packet, const Type type);
Expand Down

0 comments on commit c5579e2

Please sign in to comment.