Skip to content

View Device Address - Additional Functionality #19

@samuelnguyen999

Description

@samuelnguyen999

Review the new key-press handling implementation on the Pico platform and compare it against the previous C++ behavior. The original design included two Watchdog Timer (WDT) operations and a MAC-address reset action.

Goals

  • Verify whether watchdog timer operations (wdt_disable(), wdt_enable()) are required, supported, or should be replaced on the Pico.
  • Review the behavior of key-triggered actions (#, B, C) and update them for platform compatibility.
  • Confirm whether readMac() is needed in this UI context on the new architecture.
  • Ensure the UI/state controller does not cause unexpected resets or hangs on the Pico.

Reference: Original AVR Key Handling

case '#':  // Disable Watchdog Timer (is reboot from this?)
      wdt_disable();
      break;

    case 'B':  // Infinite loop to test Watchdog Timer
      wdt_disable();
      wdt_enable(WDTO_15MS);
      do {
      } while (true);
      break;

    case 'C':  // Reset MAC address
      Ethernet_TC::instance()->readMac(true);
      start();
      break;

readMac definition

void Ethernet_TC::readMac(bool forceReset) {
  uint8_t bytes[6];
  EEPROM_TC::instance()->getMac(bytes);
  if (forceReset || bytes[0] != '#') {
    randomSeed(analogRead(0) + millis());
    bytes[0] = '#';
    bytes[3] = random(256);
    bytes[4] = random(256);
    bytes[5] = random(256);
    EEPROM_TC::instance()->setMac(bytes);
  }
  mac[3] = bytes[3];
  mac[4] = bytes[4];
  mac[5] = bytes[5];
  serial(F("MAC address is %02x:%02x:%02x:%02x:%02x:%02x"), mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions