void usart_sendStr(char *str) { while (*str != '\0') { usart_sendChar(*str); str ++; } }
void setConfig(char* param, int16_t value) { if (strstr( param, "commutationMethod" ) != NULL) { s.commutationMethod = (uint16_t)value; //writeConfig(); //this is taken into account on next boot usart_sendStr("SET commutationMethod to "); usart_sendChar(value + 48); usart_sendStr("\n\r"); } if (strstr( param, "inputMethod" ) != NULL) { s.inputMethod = (uint16_t)value; //writeConfig(); //this is taken into account on next boot usart_sendStr("SET OK"); } if (strstr( param, "encoder_PPR" ) != NULL) { s.encoder_PPR = (uint16_t)value; //writeConfig(); usart_sendStr("SET OK"); } if (strstr( param, "encoder_poles" ) != NULL) { s.encoder_poles = (uint16_t)value; //writeConfig(); usart_sendStr("SET OK"); } if (strstr( param, "encoder_counts_per_step" ) != NULL) { s.encoder_counts_per_step = (uint16_t)value; //writeConfig(); usart_sendStr("SET OK"); } if (strstr( param, "pid_Kp" ) != NULL) { s.pid_Kp = (int16_t)value; //writeConfig(); usart_sendStr("SET OK"); } if (strstr( param, "pid_Ki" ) != NULL) { s.pid_Ki = (int16_t)value; //writeConfig(); usart_sendStr("SET OK"); } if (strstr( param, "pid_Kd" ) != NULL) { s.pid_Kd = (int16_t)value; //writeConfig(); usart_sendStr("SET OK"); } if (strstr( param, "usart_baud" ) != NULL) { s.usart_baud = (uint16_t)value; //writeConfig(); //this is taken into account on next boot usart_sendStr("SET OK"); } }