Writing config works
This commit is contained in:
parent
f654ae96f6
commit
ae1c50ee09
@ -137,7 +137,7 @@ void parse_command(uint8_t command[], uint8_t command_len) {
|
|||||||
|
|
||||||
// Validate that we have a fourth parameter, else requirements for command are
|
// Validate that we have a fourth parameter, else requirements for command are
|
||||||
// not fulfilled. return unknown command. Second parameter is u16, thus two bytes.
|
// not fulfilled. return unknown command. Second parameter is u16, thus two bytes.
|
||||||
if (command_len < 5) {
|
if (command_len < 4) {
|
||||||
context.command = UNKNOWN_COMMAND;
|
context.command = UNKNOWN_COMMAND;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -161,7 +161,16 @@ void parse_command(uint8_t command[], uint8_t command_len) {
|
|||||||
uint8_t route_command(int pos) {
|
uint8_t route_command(int pos) {
|
||||||
switch (context.command) {
|
switch (context.command) {
|
||||||
case WRITE_CONFIG:
|
case WRITE_CONFIG:
|
||||||
return WRITE_CONFIG;
|
switch (context.conf) {
|
||||||
|
case SAMPLE_TIME:
|
||||||
|
// Overwrite the config value
|
||||||
|
config.ms_fanspeed_sample_rate = context.conf_val;
|
||||||
|
|
||||||
|
// Set the flag to store it in the EEPROM
|
||||||
|
store_config = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case READ_CONFIG:
|
case READ_CONFIG:
|
||||||
{
|
{
|
||||||
switch (context.conf) {
|
switch (context.conf) {
|
||||||
|
|||||||
@ -40,8 +40,7 @@ int main() {
|
|||||||
stdout = &USART_stream;
|
stdout = &USART_stream;
|
||||||
|
|
||||||
// Read the stored config struct
|
// Read the stored config struct
|
||||||
//config = read_struct_from_EEPROM();
|
config = read_struct_from_EEPROM();
|
||||||
config.ms_fanspeed_sample_rate = 500;
|
|
||||||
|
|
||||||
PORTB.DIRSET = PIN3_bm;
|
PORTB.DIRSET = PIN3_bm;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user