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

Better signaling for network connection #166

Merged
merged 6 commits into from
Oct 5, 2021
Merged

Better signaling for network connection #166

merged 6 commits into from
Oct 5, 2021

Conversation

brentru
Copy link
Member

@brentru brentru commented Oct 4, 2021

WipperSnapper currently hangs and resets after an unsuccessful WiFi network or MQTT connection. It's difficult for the user to understand what's occurring if they aren't paying close attention to the LEDs.

This pull request:

  • Adds a maximum amount of connection attempts to the network connection and mqtt connection states
    • If the maximum attempts are exceeded, the hardware will blink red indefinitely and write the error to both the serial output and the whippersnapper boot output text file.

Addresses #165

@brentru brentru added enhancement New feature or request networking labels Oct 4, 2021
@brentru
Copy link
Member Author

brentru commented Oct 4, 2021

@hathach I have a TinyUSB-related question about this PR and this is the best place for convo.

The code calls Wippersnapper_FS::writeErrorToBootOut which successfully opens and writes to the boot text file. I call qspi_msc_flush_cb after the file is closed in order to flush the pending cache...

  // Append error output to FS
  File bootFile = wipperFatFs.open("/wipper_boot_out.txt", FILE_WRITE);
  if (bootFile) {
    bootFile.println(str);
    bootFile.close();
    qspi_msc_flush_cb();
  } else {
    WS_DEBUG_PRINTLN("ERROR: Unable to open wipper_boot_out.txt for logging!");
  }

However, the WIPPER drive (a msc_external_flash volume) only occasionally shows an updated text file when I look at the file on the USB volume.

Is there a way to reliably force the text file to update its contents? Does the TinyUSBDevice need to be detached/attached after every write?

@hathach
Copy link
Member

hathach commented Oct 5, 2021

Is there a way to reliably force the text file to update its contents? Does the TinyUSBDevice need to be detached/attached after every write?

@brentru There could be a way, but I haven't tried to figure it out. It probably involves SCSI commands manipulation such as response a error sense code, then self-recover, that maybe trigger the host to re-scan the device. It needs someone with better knowledge of SCSI command to figure it out since SCSI command is very messing https://www.seagate.com/files/staticfiles/support/docs/manual/Interface%20manuals/100293068j.pdf .

@brentru
Copy link
Member Author

brentru commented Oct 5, 2021

@hathach Ok, thanks! We'll leave it for now, then.

@brentru brentru merged commit c92b9b5 into master Oct 5, 2021
@brentru brentru deleted the network-handling branch October 26, 2021 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request networking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants