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;
m.id = IOP_MODE_REQUEST;
m.len = 0;
m.len = 4; // NOTE: LEN = 4 for padding only... temporary
sendIOPMessage(m);
}

View File

@ -194,7 +194,7 @@ class LineSwitch : public ITxSwitch
class GPIOSwitch : public ITxSwitch
{
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.interval(msec);
}

View File

@ -12,6 +12,8 @@ IOPMessage outBuf; // output message buffer
extern CATSwitch catPTT;
extern Rig rig;
int received_mode = 0;
//======================================================================
// CAT from PC-to-IOP
//
@ -50,6 +52,7 @@ void processIOPCommand(IOPMessage const& m)
{
switch(inBuf.id) {
case IOP_MODE_COMMAND:
received_mode = 2;
USBDEBUG("IOP_MODE_COMMAND received (from Raduino)");
if (m.len < 1) {
return;
@ -161,6 +164,13 @@ void serviceCAT()
{
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)) {
// timeout... clear the buffer and start over
usbCatLength = 0;

View File

@ -23,7 +23,10 @@ GPIOSwitch micPTT(true, MIC_PTT_PIN);
GPIOSwitch linePTT(false, LINE_PTT_PIN);
elapsedMillis frameMillis;
unsigned frameTime;
unsigned frameCounter;
unsigned audioProcUsage;
unsigned audioMemUsage;
//======================================================================
@ -164,11 +167,16 @@ void loop()
//frame10Hz = 0;
}
if (frameMillis > 1000) {
if (frameMillis > 5000) {
#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);
#endif
frameMillis = 0;
frameCounter = 0;
}
//audioUpdate(); // was used to update the speech compressor