diff --git a/Firmware/Bootloader/Descriptors.c b/Firmware/Bootloader/Descriptors.c index e9aacd8..e79ac4c 100644 --- a/Firmware/Bootloader/Descriptors.c +++ b/Firmware/Bootloader/Descriptors.c @@ -2,7 +2,7 @@ const USB_Descriptor_URL_t ConfigURL = URL_STRING_DESCRIPTOR(URL_HTTPS, "mon.im"); const USB_Descriptor_URL_t LocalhostURL = URL_STRING_DESCRIPTOR(URL_HTTP, "localhost"); -const USB_Descriptor_String_t ProductString = USB_STRING_DESCRIPTOR(L"VoltexBoot"); +const USB_Descriptor_String_t ProductString = USB_STRING_DESCRIPTOR(L"Voltex Boot"); const USB_Descriptor_String_t LanguageString = USB_STRING_DESCRIPTOR_ARRAY(LANGUAGE_ID_ENG); const uint8_t MS_OS_Descriptor[] = diff --git a/Firmware/PocketVoltex/Config.h b/Firmware/PocketVoltex/Config.h index 37641b1..811250d 100644 --- a/Firmware/PocketVoltex/Config.h +++ b/Firmware/PocketVoltex/Config.h @@ -45,7 +45,7 @@ typedef struct { typedef enum { GETCONFIG = 1, SETCONFIG = 2, - VERSION = 3, + VERSION = 3, // synced with bootloader, DO NOT CHANGE RESET = MAGIC_RESET_NUMBER } command_action_t; diff --git a/Firmware/PocketVoltex/PocketVoltex.c b/Firmware/PocketVoltex/PocketVoltex.c index a92cc44..d58448c 100644 --- a/Firmware/PocketVoltex/PocketVoltex.c +++ b/Firmware/PocketVoltex/PocketVoltex.c @@ -13,10 +13,6 @@ // D 4,5,6,7 #define SWITCH_MASKD 0b11110000 -#define MAGIC_BOOT_KEY 0xDEADBE7A -// offset * word size -#define BOOTLOADER_START_ADDRESS (0x1c00 * 2) - // How long to wait before moving to internal lighting #define HID_LED_TIMEOUT 2000 @@ -94,26 +90,11 @@ static uint8_t switchesChanged = 1; // Set to max already so we have our init flash static uint16_t hidTimeout = HID_LED_TIMEOUT; -uint32_t Boot_Key ATTR_NO_INIT; - -void Bootloader_Jump_Check(void) ATTR_INIT_SECTION(3); -void Bootloader_Jump_Check(void) -{ - // If the reset source was the bootloader and the key is correct, clear it and jump to the bootloader - if ((MCUSR & (1 << WDRF)) && (Boot_Key == MAGIC_BOOT_KEY)) - { - Boot_Key = 0; - ((void (*)(void))BOOTLOADER_START_ADDRESS)(); - } -} - void RebootToBootloader(void) { - // With this uncommented, reboot fails. Odd. - //USB_Disable(); - cli(); + /* Disconnect from the host - USB interface will be reset later along with the AVR */ + USB_Detach(); // Back to the bootloader - Boot_Key = MAGIC_BOOT_KEY; wdt_enable(WDTO_250MS); while(1); } @@ -246,11 +227,6 @@ void SetupHardware() PORTC |= SWITCH_MASKC; PORTC &= ~_BV(1); // RESET has its own pullup PORTD |= SWITCH_MASKD; - - // RESET held while plugging in - if(!(PINC & _BV(1))) { - RebootToBootloader(); - } /* Hardware Initialization */ encoder_init(); diff --git a/Firmware/PocketVoltex/makefile b/Firmware/PocketVoltex/makefile index 188e7e5..2e981c1 100644 --- a/Firmware/PocketVoltex/makefile +++ b/Firmware/PocketVoltex/makefile @@ -54,7 +54,10 @@ rfuse: $(AVRDUDE) -U hfuse:r:-:h -U lfuse:r:-:h -U efuse:r:-:h wfuse: - $(AVRDUDE) -U lfuse:w:0xde:m -U hfuse:w:0x9b:m -U efuse:w:0xf6:m + # no more HWB, boot directly to bootloader + $(AVRDUDE) -U lfuse:w:0xde:m -U hfuse:w:0xda:m -U efuse:w:0xfe:m + # reset disabled + #$(AVRDUDE) -U lfuse:w:0xde:m -U hfuse:w:0x9a:m -U efuse:w:0xfe:m # To make this hex, compile HID Bootloader in LUFA # FLASH_SIZE_KB := 16