Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/menubar'
Browse files Browse the repository at this point in the history
  • Loading branch information
keesverruijt committed Aug 8, 2024
2 parents 9b938a6 + 4e1736d commit d738fdb
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG-PLUGIN.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Sections can be: Added Changed Deprecated Removed Fixed Security.

## [Unreleased]

- #248: Adaptation of StayAlive message to latest format, tested with Halo20+ and Halo3008

## [5.5.0]

This release is mainly focused on compatibility with OpenCPN 5.8.0 which uses a new UI library
Expand Down
3 changes: 2 additions & 1 deletion include/RadarInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ class RadarInfo {
RadarControlItem m_coarse_tune;
RadarControlItem m_magnetron_current;
RadarControlItem m_color_gain;
uint8_t m_stay_alive_type;

bool m_showManualValueInAuto; // Does radar adjust manual value in auto
// mode? True for Garmin, False for others
Expand Down Expand Up @@ -195,7 +196,7 @@ class RadarInfo {
time_t m_data_timeout; // When we consider the data to be obsolete (radar no
// longer sending data)
time_t m_stayalive_timeout; // When we will send another stayalive ping
#define STAYALIVE_TIMEOUT (5) // Send data every 5 seconds to ping radar
#define STAYALIVE_TIMEOUT (1) // Send data every 1 seconds to ping radar
#define DATA_TIMEOUT (5)

bool m_status_text_hide;
Expand Down
1 change: 1 addition & 0 deletions src/RadarInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ RadarInfo::RadarInfo(radar_pi *pi, int radar) {
m_rotation_period.Update(0);
m_magnetron_current.Update(0);
m_rotation_period.Update(0);
m_stay_alive_type = 0;

m_range_adjustment.Update(0, RCS_MANUAL);
m_quantum2type = false;
Expand Down
33 changes: 26 additions & 7 deletions src/navico/NavicoControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ static const uint8_t COMMAND_TX_OFF_B[3] = {0x01, 0xc1, 0x00}; // OFF part 1, n
static const uint8_t COMMAND_TX_ON_A[3] = {0x00, 0xc1, 0x01}; // ON part 1
static const uint8_t COMMAND_TX_ON_B[3] = {0x01, 0xc1, 0x01}; // ON part 2

static const uint8_t COMMAND_STAY_ON_A[2] = {0xA0, 0xc1};
static const uint8_t COMMAND_STAY_ON_A[2] = {0xa0, 0xc1};
static const uint8_t COMMAND_STAY_ON_B[2] = {0x03, 0xc2};
static const uint8_t COMMAND_STAY_ON_C[2] = {0x04, 0xc2};
static const uint8_t COMMAND_STAY_ON_D[2] = {0x05, 0xc2};
static const uint8_t COMMAND_STAY_ON_E[2] = {0x0a, 0xc2};

bool NavicoControl::Init(radar_pi *pi, RadarInfo *ri, NetworkAddress &ifadr, NetworkAddress &radaradr) {
int r;
Expand Down Expand Up @@ -128,15 +129,33 @@ void NavicoControl::RadarTxOn() {
IF_LOG_AT(LOGLEVEL_VERBOSE | LOGLEVEL_TRANSMIT, wxLogMessage(wxT("%s transmit: turn on"), m_name.c_str()));
TransmitCmd(COMMAND_TX_ON_A, sizeof(COMMAND_TX_ON_A));
TransmitCmd(COMMAND_TX_ON_B, sizeof(COMMAND_TX_ON_B));
m_ri->m_stay_alive_type = 0;
}

bool NavicoControl::RadarStayAlive() {
LOG_TRANSMIT(wxT("%s transmit: stay alive"), m_name.c_str());

TransmitCmd(COMMAND_STAY_ON_A, sizeof(COMMAND_STAY_ON_A));
TransmitCmd(COMMAND_STAY_ON_B, sizeof(COMMAND_STAY_ON_B));
TransmitCmd(COMMAND_STAY_ON_C, sizeof(COMMAND_STAY_ON_C));
return TransmitCmd(COMMAND_STAY_ON_D, sizeof(COMMAND_STAY_ON_D));
LOG_TRANSMIT(wxT("%s transmit: stay alive, sequence=%i"), m_name.c_str(), m_ri->m_stay_alive_type); //$$$
bool tx = false;
switch (m_ri->m_stay_alive_type) {
case 0:
TransmitCmd(COMMAND_STAY_ON_A, sizeof(COMMAND_STAY_ON_A)); // a0, c1
TransmitCmd(COMMAND_STAY_ON_B, sizeof(COMMAND_STAY_ON_B)); // 03, c2
TransmitCmd(COMMAND_STAY_ON_C, sizeof(COMMAND_STAY_ON_C)); // 04, c2
TransmitCmd(COMMAND_STAY_ON_D, sizeof(COMMAND_STAY_ON_D)); // 05, c2
tx = TransmitCmd(COMMAND_STAY_ON_E, sizeof(COMMAND_STAY_ON_E)); // 0a, c2
break;
case 1:
case 2:
case 3:
tx = TransmitCmd(COMMAND_STAY_ON_A, sizeof(COMMAND_STAY_ON_A)); // a0, c1
break;
default:
break;
}
m_ri->m_stay_alive_type++;
if (m_ri->m_stay_alive_type == 4) {
m_ri->m_stay_alive_type = 0;
}
return tx;
}

bool NavicoControl::SetRange(int meters) {
Expand Down
14 changes: 13 additions & 1 deletion src/radar_pi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -766,13 +766,25 @@ void radar_pi::OnToolbarToolCallback(int id) {
}
}

if (m_settings.show) {
if (m_settings.show) { // $$$to do
LOG_DIALOG(wxT("OnToolbarToolCallback: Hide radar windows"));
m_settings.show = 0;
SetRadarWindowViz();
} else {
LOG_DIALOG(wxT("OnToolbarToolCallback: Show radar windows"));
m_settings.show = 1;

for (size_t r = 0; r < M_SETTINGS.radar_count; r++) {

LOG_DIALOG(wxT("OnToolbarToolCallback: show controls for radar %i"), r);
if (m_settings.show_radar_control[r] == 0) {
ShowRadarControl(r, true);
}

}



SetRadarWindowViz();
}
UpdateState();
Expand Down

0 comments on commit d738fdb

Please sign in to comment.