diff --git a/right/src/config_parser/config_state.c b/right/src/config_parser/config_state.c index 0a299b9..3bb01c3 100644 --- a/right/src/config_parser/config_state.c +++ b/right/src/config_parser/config_state.c @@ -3,11 +3,10 @@ static uint8_t hardwareConfig[HARDWARE_CONFIG_SIZE]; config_buffer_t HardwareConfigBuffer = {hardwareConfig}; -static uint8_t userConfig[USER_CONFIG_SIZE]; -static uint8_t __attribute__((section (".m_data_2"))) stagingUserConfig[USER_CONFIG_SIZE]; - -config_buffer_t UserConfigBuffer = { userConfig }; -config_buffer_t StagingUserConfigBuffer = { stagingUserConfig }; +static uint8_t userConfig1[USER_CONFIG_SIZE]; +static uint8_t __attribute__((section (".m_data_2"))) userConfig2[USER_CONFIG_SIZE]; +config_buffer_t UserConfigBuffer = { userConfig1 }; +config_buffer_t StagingUserConfigBuffer = { userConfig2 }; bool ParserRunDry; diff --git a/right/src/usb_protocol_handler.c b/right/src/usb_protocol_handler.c index b2b5917..cbbce18 100644 --- a/right/src/usb_protocol_handler.c +++ b/right/src/usb_protocol_handler.c @@ -95,9 +95,13 @@ void TestConfig(void) void applyConfig(void) { + uint8_t *temp; + TestConfig(); // This line will be removed. TestConfig will be called by Agent separately. - memcpy(&UserConfigBuffer, &StagingUserConfigBuffer, USER_CONFIG_SIZE); ParserRunDry = false; + temp = UserConfigBuffer.buffer; + UserConfigBuffer.buffer = StagingUserConfigBuffer.buffer; + StagingUserConfigBuffer.buffer = temp; UserConfigBuffer.offset = 0; GenericHidOutBuffer[0] = ParseConfig(&UserConfigBuffer); GenericHidOutBuffer[1] = UserConfigBuffer.offset;