Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GarminHD range fix #123

Merged
merged 4 commits into from Feb 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/garminhd/GarminHDControl.cpp
Expand Up @@ -179,8 +179,8 @@ bool GarminHDControl::SetRange(int meters) {

packet.packet_type = 0x2b3;
packet.len1 = sizeof(packet.parm1);
packet.parm1 = meters;
LOG_VERBOSE(wxT("radar_pi: %s transmit: range %d meters"), m_name.c_str(), meters);
packet.parm1 = meters-1;
LOG_VERBOSE(wxT("radar_pi: %s transmit: range %d meters"), m_name.c_str(), meters-1);
return TransmitCmd(&packet, sizeof(packet));
}
return false;
Expand Down
6 changes: 3 additions & 3 deletions src/garminhd/GarminHDReceive.cpp
Expand Up @@ -106,7 +106,7 @@ void GarminHDReceive::ProcessFrame(radar_line *packet) {
}

m_ri->m_state.Update(RADAR_TRANSMIT);
m_ri->m_range.Update(packet->range_meters);
m_ri->m_range.Update(packet->range_meters+1);
m_ri->m_gain.Update(packet->gain_level[0], packet->gain_level[1] ? RCS_AUTO_1 : RCS_MANUAL);
m_ri->m_rain.Update(packet->sea_clutter[0], packet->sea_clutter[1] ? RCS_AUTO_1 : RCS_MANUAL);
m_ri->m_rain.Update(packet->rain_clutter[0]);
Expand Down Expand Up @@ -526,8 +526,8 @@ bool GarminHDReceive::ProcessReport(const uint8_t *report, size_t len) {
}

case 0x2a7: {
LOG_VERBOSE(wxT("0x02a7: range %d"), packet->range_meters); // Range in meters
m_ri->m_range.Update(packet->range_meters);
LOG_VERBOSE(wxT("0x02a7: range %d"), packet->range_meters+1); // Range in meters
m_ri->m_range.Update(packet->range_meters+1);

LOG_VERBOSE(wxT("0x02a7: gain %d"), packet->gain_level); // Gain
m_gain = packet->gain_level;
Expand Down
4 changes: 2 additions & 2 deletions src/garminhd/garminhdtype.h
Expand Up @@ -15,12 +15,12 @@ PLUGIN_END_NAMESPACE
// Garmin mixed range is the same as nautical miles, it does not support really short ranges
#define RANGE_MIXED_RT_GARMIN_HD \
{ \
1852 / 8, 1852 / 4, 1852 / 2, 1852 * 3 / 4, 1852 * 1, 1852 * 3 / 2, 1852 * 2, 1852 * 3, 1852 * 4, 1852 * 6, 1852 * 8, \
232, 1852 / 4, 1852 / 2, 1852 * 3 / 4, 1852 * 1, 1852 * 3 / 2, 1852 * 2, 1852 * 3, 1852 * 4, 1852 * 6, 1852 * 8, \
1852 * 12, 1852 * 16, 1852 * 24, 1852 * 36, 1852 * 48 \
}
#define RANGE_NAUTIC_RT_GARMIN_HD \
{ \
1852 / 8, 1852 / 4, 1852 / 2, 1852 * 3 / 4, 1852 * 1, 1852 * 3 / 2, 1852 * 2, 1852 * 3, 1852 * 4, 1852 * 6, 1852 * 8, \
232, 1852 / 4, 1852 / 2, 1852 * 3 / 4, 1852 * 1, 1852 * 3 / 2, 1852 * 2, 1852 * 3, 1852 * 4, 1852 * 6, 1852 * 8, \
1852 * 12, 1852 * 16, 1852 * 24, 1852 * 36, 1852 * 48 \
}

Expand Down