Skip to content

Setting RELEASE_MODE breaks the adapter because Usb.Init() is not called. #83

Description

@sromeroi

When you uncomment RELEASE_MODE in debug.h to remove all the Serial.print() debugging stuff, the adapter does not work.

The issue is in the setup() function in RFUSB_to_DB15.ino:

void setup() {
  #ifndef RELEASE_MODE
  Serial.begin(115200);

  while (!Serial);

  byte i, j;

  if (Usb.Init() == -1) {
    Serial.print(F("\r\nOSC did not start"));
    while (1);
  }
  #endif                // <----------------------------------------------

  pinMode(LED_PIN, OUTPUT);
}

The #endif statement, placed here, prevents Usb.Init() from being executed, and thus the USB is not initialized.

Instead, it should be:

void setup() {
  #ifndef RELEASE_MODE
  Serial.begin(115200);

  while (!Serial);
  #endif

  byte i, j;

  if (Usb.Init() == -1) {
    Serial.print(F("\r\nOSC did not start"));
    while (1);
  }

  pinMode(LED_PIN, OUTPUT);
}

(You can also wrap the "OSC did not start" error with an #ifdef)

  if (Usb.Init() == -1) {
    #ifndef RELEASE_MODE
        Serial.print(F("\r\nOSC did not start"));
    #endif
    while (1);
  }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions