|  | @@ -23,14 +23,14 @@
 | 
	
		
			
				|  |  |  #define PIN_USB_PWR_SINK	8
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  uint8_t efuse_default_mac[6];
 | 
	
		
			
				|  |  | +char serial_number[16];		// Canonical board serial number
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  void setup_usb_ids()
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  |      uint8_t * const mac = efuse_default_mac;
 | 
	
		
			
				|  |  | -    char serial[16];
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      esp_efuse_mac_get_default(mac);
 | 
	
		
			
				|  |  | -    snprintf(serial, sizeof serial, "%02X%02X%02X-%02X%02X%02X",
 | 
	
		
			
				|  |  | +    snprintf(serial_number, sizeof serial_number, "%02X%02X%02X-%02X%02X%02X",
 | 
	
		
			
				|  |  |  	     mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      USB.VID(0x4680);
 | 
	
	
		
			
				|  | @@ -38,7 +38,7 @@ void setup_usb_ids()
 | 
	
		
			
				|  |  |      USB.firmwareVersion(1);	// Do something smarter here
 | 
	
		
			
				|  |  |      USB.productName("MAX80 Network Controller");
 | 
	
		
			
				|  |  |      USB.manufacturerName("Peter & Per");
 | 
	
		
			
				|  |  | -    USB.serialNumber(serial);
 | 
	
		
			
				|  |  | +    USB.serialNumber(serial_number);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  static void heap_info()
 | 
	
	
		
			
				|  | @@ -60,8 +60,6 @@ static void dump_config()
 | 
	
		
			
				|  |  |      printf("--- End configuration and status\n");
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -uint8_t max80_board_version;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  static void init_hw()
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  |      // Start out with disabled shared I/O pins
 | 
	
	
		
			
				|  | @@ -84,22 +82,6 @@ static void init_hw()
 | 
	
		
			
				|  |  |      pinMode(PIN_USB_PWR_SINK, OUTPUT);		// IO8: USB_PWR_SINK
 | 
	
		
			
				|  |  |      digitalWrite(PIN_USB_PWR_SINK, 0);		// This is a power sink
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | - #if 0
 | 
	
		
			
				|  |  | -    pinMode(PIN_USB_PWR_EN, OUTPUT);
 | 
	
		
			
				|  |  | -    digitalWrite(PIN_USB_PWR_EN, 0);
 | 
	
		
			
				|  |  | -    delayMicroseconds(100);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    pinMode(PIN_USB_PWR_EN, INPUT_PULLUP);
 | 
	
		
			
				|  |  | -    delayMicroseconds(50);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    pinMode(PIN_USB_PWR_EN, INPUT);
 | 
	
		
			
				|  |  | -    delayMicroseconds(50);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    max80_board_version = digitalRead(PIN_USB_PWR_EN) ? 1 : 2;
 | 
	
		
			
				|  |  | -#else
 | 
	
		
			
				|  |  | -    max80_board_version = 2;
 | 
	
		
			
				|  |  | -#endif
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      pinMode(PIN_USB_PWR_EN, OUTPUT);
 | 
	
		
			
				|  |  |      digitalWrite(PIN_USB_PWR_EN, 0);
 | 
	
		
			
				|  |  |      delayMicroseconds(50);
 | 
	
	
		
			
				|  | @@ -123,6 +105,8 @@ void setup() {
 | 
	
		
			
				|  |  |      printf("[FW]   MAX80 firmware compiled on %s\n", fwdate);
 | 
	
		
			
				|  |  |      printf("[PCB]  MAX80 board version: %s\n", board_info.version_str);
 | 
	
		
			
				|  |  |      setenv_cond("status.max80.hw.ver", board_info.version_str);
 | 
	
		
			
				|  |  | +    printf("[PCB]  MAX80 serial number: %s\n", serial_number);
 | 
	
		
			
				|  |  | +    setenv_cond("status.max80.hw.serial", serial_number);
 | 
	
		
			
				|  |  |      Serial.println("MAX80 start");
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      init_config();
 |