Some DEBUG updates. Compiles, runs; not comprehensively tested.

This commit is contained in:
Rob French 2020-05-26 10:49:15 -05:00
parent 322909c6f2
commit 5e16a49859
4 changed files with 22 additions and 4 deletions

View File

@ -83,7 +83,7 @@ void sendIOPModeRequest()
{ {
IOPMessage m; IOPMessage m;
m.id = IOP_MODE_REQUEST; m.id = IOP_MODE_REQUEST;
m.len = 0; m.len = 4; // NOTE: LEN = 4 for padding only... temporary
sendIOPMessage(m); sendIOPMessage(m);
} }

View File

@ -194,7 +194,7 @@ class LineSwitch : public ITxSwitch
class GPIOSwitch : public ITxSwitch class GPIOSwitch : public ITxSwitch
{ {
public: public:
GPIOSwitch(bool is_mic, int pin, int msec=25): _is_mic(false), _ssb_mode(false), _bounce() { GPIOSwitch(bool is_mic, int pin, int msec=25): _is_mic(is_mic), _ssb_mode(false), _bounce() {
_bounce.attach(pin, INPUT_PULLUP); _bounce.attach(pin, INPUT_PULLUP);
_bounce.interval(msec); _bounce.interval(msec);
} }

View File

@ -12,6 +12,8 @@ IOPMessage outBuf; // output message buffer
extern CATSwitch catPTT; extern CATSwitch catPTT;
extern Rig rig; extern Rig rig;
int received_mode = 0;
//====================================================================== //======================================================================
// CAT from PC-to-IOP // CAT from PC-to-IOP
// //
@ -50,6 +52,7 @@ void processIOPCommand(IOPMessage const& m)
{ {
switch(inBuf.id) { switch(inBuf.id) {
case IOP_MODE_COMMAND: case IOP_MODE_COMMAND:
received_mode = 2;
USBDEBUG("IOP_MODE_COMMAND received (from Raduino)"); USBDEBUG("IOP_MODE_COMMAND received (from Raduino)");
if (m.len < 1) { if (m.len < 1) {
return; return;
@ -161,6 +164,13 @@ void serviceCAT()
{ {
uint8_t incomingByte; uint8_t incomingByte;
// First, if we've never received or requested a mode command from the Raduino, send a request.
if (received_mode == 0) {
USBDEBUG("requesting mode");
sendIOPModeRequest();
received_mode = 1;
}
if ((usbCatLength > 0) && (usbCatTimer > CAT_RECEIVE_TIMEOUT)) { if ((usbCatLength > 0) && (usbCatTimer > CAT_RECEIVE_TIMEOUT)) {
// timeout... clear the buffer and start over // timeout... clear the buffer and start over
usbCatLength = 0; usbCatLength = 0;

View File

@ -23,7 +23,10 @@ GPIOSwitch micPTT(true, MIC_PTT_PIN);
GPIOSwitch linePTT(false, LINE_PTT_PIN); GPIOSwitch linePTT(false, LINE_PTT_PIN);
elapsedMillis frameMillis; elapsedMillis frameMillis;
unsigned frameTime;
unsigned frameCounter; unsigned frameCounter;
unsigned audioProcUsage;
unsigned audioMemUsage;
//====================================================================== //======================================================================
@ -164,11 +167,16 @@ void loop()
//frame10Hz = 0; //frame10Hz = 0;
} }
if (frameMillis > 1000) { if (frameMillis > 5000) {
#if defined(DEBUG) #if defined(DEBUG)
sprintf(frame_status, "update: %d ms, %d frames\n", frameMillis, frameCounter); frameTime = frameMillis;
audioProcUsage = AudioProcessorUsageMax();
audioMemUsage = AudioMemoryUsageMax();
sprintf(frame_status, "update: %u ms, %u frames, %d %% CPU max, %d %% mem max\n", frameTime, frameCounter, audioProcUsage, audioMemUsage);
USBDEBUG(frame_status); USBDEBUG(frame_status);
#endif #endif
frameMillis = 0;
frameCounter = 0;
} }
//audioUpdate(); // was used to update the speech compressor //audioUpdate(); // was used to update the speech compressor