Fixes associated with the Raduino display issues.

This commit is contained in:
Rob French 2020-06-07 15:27:27 -05:00
parent bebd5ad78e
commit 2e115e363b
4 changed files with 67 additions and 15 deletions

View File

@ -87,6 +87,20 @@ void sendIOPModeRequest()
sendIOPMessage(m); sendIOPMessage(m);
} }
//======================================================================
void sendIOPDebugMessage(const char* text)
{
IOPMessage m;
m.id = IOP_DEBUG_MSG;
m.len = strlen(text);
if (m.len > IOP_MESSAGE_MAX_LEN) {
m.len = IOP_MESSAGE_MAX_LEN;
}
strncpy(m.data, text, m.len);
sendIOPMessage(m);
};
//====================================================================== //======================================================================
// SSB STATUS MESSAGE // SSB STATUS MESSAGE
//====================================================================== //======================================================================
@ -152,24 +166,36 @@ void sendIOPTestStatus()
} }
//====================================================================== //======================================================================
// TEST STATUS MESSAGE // MENU DISPLAY MESSAGE
//====================================================================== //======================================================================
void sendIOPMenuDisplay(const char* text, int8_t secs) void sendIOPMenuDisplay(const char* text)
{ {
IOPMessage m; IOPMessage m;
int l = strlen(text); int l = strlen(text);
m.id = IOP_MENU_DISPLAY_MSG; m.id = IOP_MENU_DISPLAY_MSG;
m.len = 17; m.len = 16;
m.data[0] = uint8_t(secs);
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
if (i < l) { if (i < l) {
m.data[i+1] = text[i]; m.data[i] = text[i];
} else { } else {
m.data[i+1] = ' '; m.data[i] = ' ';
} }
} }
m.data[17] = '\0'; m.data[16] = '\0';
sendIOPMessage(m);
Serial.println((char *)m.data);
}
//======================================================================
// MENU INACTIVE MESSAGE
//======================================================================
void sendIOPMenuInactive()
{
IOPMessage m;
m.id = IOP_MENU_INACTIVE_MSG;
m.len = 4; // NOTE: LEN = 4 for padding only... temporary
sendIOPMessage(m); sendIOPMessage(m);
} }

View File

@ -67,6 +67,7 @@ enum MessageID {
IOP_START_TX_COMMAND, IOP_START_TX_COMMAND,
IOP_STOP_TX_COMMAND, IOP_STOP_TX_COMMAND,
IOP_CW_CONFIG_MSG, IOP_CW_CONFIG_MSG,
IOP_DEBUG_MSG,
// Requests // Requests
IOP_MODE_REQUEST, IOP_MODE_REQUEST,
@ -75,6 +76,7 @@ enum MessageID {
IOP_CW_STATUS_MSG, IOP_CW_STATUS_MSG,
IOP_TEST_STATUS_MSG, IOP_TEST_STATUS_MSG,
IOP_MENU_DISPLAY_MSG, IOP_MENU_DISPLAY_MSG,
IOP_MENU_INACTIVE_MSG,
// add any new elements here // add any new elements here
NUM_MESSAGE_IDS NUM_MESSAGE_IDS
@ -136,6 +138,7 @@ const uint8_t NO_FLAGS = 0;
const uint8_t REVERSED = 1; const uint8_t REVERSED = 1;
struct IOPMessage { struct IOPMessage {
IOPMessage() { memset(data, 0, IOP_MESSAGE_MAX_LEN); }
uint8_t id; uint8_t id;
uint8_t len; uint8_t len;
uint8_t data[IOP_MESSAGE_MAX_LEN]; uint8_t data[IOP_MESSAGE_MAX_LEN];
@ -215,13 +218,15 @@ void recvIOPMessage(IOPMessage&, const uint8_t*, int);
void sendIOPModeCommand(RigMode); void sendIOPModeCommand(RigMode);
void sendIOPStartTxCommand(); void sendIOPStartTxCommand();
void sendIOPStopTxCommand(); void sendIOPStopTxCommand();
void sendIOPDebugMessage(const char*);
void sendIOPModeRequest(); void sendIOPModeRequest();
void sendIOPSSBStatus(SSBConfig const&); void sendIOPSSBStatus(SSBConfig const&);
void sendIOPDGTStatus(DGTConfig const&); void sendIOPDGTStatus(DGTConfig const&);
void sendIOPCWStatus(CWConfig const&); void sendIOPCWStatus(CWConfig const&);
void sendIOPTestStatus(); void sendIOPTestStatus();
void sendIOPMenuDisplay(const char*, int8_t); void sendIOPMenuDisplay(const char*);
void sendIOPMenuInactive();
//====================================================================== //======================================================================
// TRANSLATOR // TRANSLATOR

View File

@ -84,6 +84,10 @@ void processIOPCommand(IOPMessage const& m)
case RIG_MODE_TTU: case RIG_MODE_TTU:
USBDEBUG("new mode - TTU"); USBDEBUG("new mode - TTU");
break; break;
default:
char errormessage[32];
sprintf(errormessage, "unknown mode command - %3d", rig.modeNum());
USBDEBUG("mode command not recognized");
} }
#endif #endif
} }
@ -99,6 +103,11 @@ void processIOPCommand(IOPMessage const& m)
case IOP_CW_CONFIG_MSG: case IOP_CW_CONFIG_MSG:
break; break;
case IOP_DEBUG_MSG:
USBDEBUG("IOP_DEBUG_MSG");
USBDEBUG((const char*)m.data);
break;
} }
} }

View File

@ -11,6 +11,8 @@
#define MAX_TEXT_LEN 16 #define MAX_TEXT_LEN 16
#define MENU_SELECTED_CHAR '>' #define MENU_SELECTED_CHAR '>'
const char blankLine[17] = " ";
class MenuItem { class MenuItem {
public: public:
virtual ~MenuItem() {} virtual ~MenuItem() {}
@ -37,7 +39,7 @@ const char* const filterID[NUM_RIG_MODES][NUM_RX_FILTERS] = {
class TopMenu : public MenuItem { class TopMenu : public MenuItem {
public: public:
TopMenu(Rig& rig): _rig(rig), _visible(false), _adjust_tx(false) { TopMenu(Rig& rig): _rig(rig), _dirty(false), _visible(false), _adjust_tx(false) {
strcpy(_text0, "R: T: "); strcpy(_text0, "R: T: ");
strcpy(_text1, "0123456789ABCDEF"); strcpy(_text1, "0123456789ABCDEF");
} }
@ -52,12 +54,16 @@ class TopMenu : public MenuItem {
_adjust_tx ? ' ' : MENU_SELECTED_CHAR, _adjust_tx ? ' ' : MENU_SELECTED_CHAR,
filterID[_rig.modeNum()][_rig.filterNum()], filterID[_rig.modeNum()][_rig.filterNum()],
_adjust_tx ? MENU_SELECTED_CHAR : ' '); _adjust_tx ? MENU_SELECTED_CHAR : ' ');
if (strcmp(_text0, _text1) != 0) { if ((strcmp(_text0, _text1) != 0) || _dirty) {
if (_visible) { if (_visible) {
sendIOPMenuDisplay(_text0, 0); sendIOPMenuDisplay(_text0);
USBDEBUG("updating menu:");
USBDEBUG(_text0);
} else { } else {
sendIOPMenuDisplay(_text0, -1); sendIOPMenuInactive();
USBDEBUG("deactivating menu");
} }
_dirty = false;
strncpy(_text1, _text0, MAX_TEXT_LEN); strncpy(_text1, _text0, MAX_TEXT_LEN);
} }
} }
@ -68,12 +74,14 @@ class TopMenu : public MenuItem {
} else { } else {
_adjust_tx = !_adjust_tx; _adjust_tx = !_adjust_tx;
} }
_dirty = true;
return this; return this;
} }
virtual MenuItem* altSelect() { virtual MenuItem* altSelect() {
if (_visible) { if (_visible) {
_visible = false; _visible = false;
_dirty = true;
} }
return this; return this;
} }
@ -81,6 +89,7 @@ class TopMenu : public MenuItem {
virtual MenuItem* exit() { virtual MenuItem* exit() {
if (_visible) { if (_visible) {
_visible = false; _visible = false;
_dirty = true;
} }
return this; return this;
} }
@ -91,6 +100,7 @@ class TopMenu : public MenuItem {
} else { } else {
_rig.switchRxFilter(true); _rig.switchRxFilter(true);
} }
_dirty = true;
} }
return this; return this;
} }
@ -101,12 +111,14 @@ class TopMenu : public MenuItem {
} else { } else {
_rig.switchRxFilter(); _rig.switchRxFilter();
} }
_dirty = true;
} }
return this; return this;
} }
private: private:
Rig& _rig; Rig& _rig;
bool _dirty;
bool _visible; bool _visible;
bool _adjust_tx; bool _adjust_tx;
char _text0[MAX_TEXT_LEN+1]; char _text0[MAX_TEXT_LEN+1];