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

QRSS mode crash - Funtronics FK-11 hardware #125

Open
Olivier-ADLER opened this issue Apr 14, 2022 · 2 comments
Open

QRSS mode crash - Funtronics FK-11 hardware #125

Olivier-ADLER opened this issue Apr 14, 2022 · 2 comments

Comments

@Olivier-ADLER
Copy link

Each time i try to switch to QRSS mode in CLI, i get a crash and reboot after the watchdog timer. If i disable the avr watchdog function, then the AVR crash and does not reboot.

This exhibit using the latest github version. Does not seem related to this particular version because the original firmware i had on the FK-11 board was a couple years younger and had the same crash problem when enabling QRSS.

@Olivier-ADLER
Copy link
Author

Olivier-ADLER commented Apr 15, 2022

After checking the code it seems that the serial_qrss_mode() function check only the primary serial port, but on this board there is a secondary serial port. So i think that the while loop of this function never end because it never receive serial input, and trigger the AVR watchdog.

There is two other problems : the reported dit lenght is wrong, forgetting an ascii string to decimal conversion, and after entering the \q command there is no more serial echo, so we do not see the entered value. I'm working on modified code. First compilation checks are confirming my first finds.

@Olivier-ADLER
Copy link
Author

Olivier-ADLER commented Apr 15, 2022

Here is a working dirty code modification (dirty because it does not take into account hardware serial ports definitions).

There is still a watchdog reset problem if return is not pressed 4 seconds after the \q command. I will leave that to someone that better master the code. Other problems have been corrected.

`void serial_qrss_mode()
{
byte looping = 1;
byte incoming_serial_byte;
byte numbers[4];
byte numberindex = 0;
String numberstring;
byte error =0;

while (looping) {
if (secondary_serial_port->available() == 0) { // wait for the next keystroke
if (keyer_machine_mode == KEYER_NORMAL) { // might as well do something while we're waiting
check_paddles();
service_dit_dah_buffers();
//check_the_memory_buttons();
}
} else {

  incoming_serial_byte = secondary_serial_port->read();
  secondary_serial_port->write(incoming_serial_byte);
  if ((incoming_serial_byte > 47) && (incoming_serial_byte < 58)) {    // ascii 48-57 = "0" - "9")
    numberstring = numberstring + incoming_serial_byte;
    numbers[numberindex] = incoming_serial_byte;

// primary_serial_port->write("numberindex:");
// primary_serial_port->print(numberindex,DEC);
// primary_serial_port->write(" numbers:");
// primary_serial_port->println(numbers[numberindex],DEC);
numberindex++;
if (numberindex > 2)
{
looping = 0;
error = 1;
}
} else {
if (incoming_serial_byte == 13) { // carriage return - get out
looping = 0;
} else { // bogus input - error out
looping = 0;
error = 1;
}
}
}
}

if (error) {
secondary_serial_port->println(F("Error..."));
while (secondary_serial_port->available() > 0) { incoming_serial_byte = secondary_serial_port->read(); } // clear out buffer
return;
} else {
if (speed_mode != SPEED_QRSS) {
secondary_serial_port->print(F(" Setting keyer to QRSS Mode, Enter \R to leave. Dit length : "));
} else {
secondary_serial_port->print(F(" Changing QRSS speed. Dit length : "));
}
int y = 1;
int set_dit_length = 0;
for (int x = (numberindex - 1); x >= 0 ; x = x - 1) {
set_dit_length = set_dit_length + ((numbers[x]-48) * y);
y = y * 10;
}
if (set_dit_length == 0) {
qrss_dit_length = initial_qrss_dit_length;
} else {
qrss_dit_length = set_dit_length;
}
speed_mode = SPEED_QRSS;
secondary_serial_port->print(qrss_dit_length);
secondary_serial_port->println(F(" seconds"));
}
}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant