Skip to content

Commit

Permalink
quick macro를 업로드 할 경우 일부 옵션 설정이 초기화되는 것을 패치
Browse files Browse the repository at this point in the history
  • Loading branch information
showjean committed Sep 22, 2017
1 parent 4258c64 commit 0160a5c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion firmware/ps2avrGB/eeprominfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
// 409~420 : 12bytes
#define EEPROM_MACRO 421 // ~996
#define EEPROM_LED2_COLOR_KEY1 997 // 3byte ~999
// 1000~1024 : 25bytes
// 1000~1023 : 24bytes

#endif
18 changes: 16 additions & 2 deletions firmware/ps2avrGB/vusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,15 +457,29 @@ void updateQuickMacro(uint8_t *data, uint8_t len)
len += -2;
data += 2;
}
eeprom_update_block(data, (uint8_t *)quickMacroAddress, len);

// quick macro의 eeprom address 범위를 넘어서지 않도록 패치
if(quickMacroAddress >= (EEPROM_MACRO + MACRO_SIZE_MAX * MACRO_NUM))
{
return;

}
else if(quickMacroAddress + len > (EEPROM_MACRO + MACRO_SIZE_MAX * MACRO_NUM))
{
len = (EEPROM_MACRO + MACRO_SIZE_MAX * MACRO_NUM) - quickMacroAddress;
}

eeprom_update_block(data, (void *)quickMacroAddress, len);
quickMacroAddress += len;

/*uint8_t i;
for(i = 0; i< len; ++i)
{
eeprom_update_byte((uint8_t *)quickMacroAddress, *data);
eeprom_update_byte((void *)quickMacroAddress, *data);
quickMacroAddress++;
data++;
if(quickMacroAddress >= (EEPROM_MACRO + MACRO_SIZE_MAX * MACRO_NUM)) return;
}*/
}
/*
Expand Down

0 comments on commit 0160a5c

Please sign in to comment.