Add bootloader flag in the flash
This commit is contained in:
parent
ec086e2d47
commit
c0c42339f1
5 changed files with 17 additions and 2 deletions
|
@ -118,6 +118,11 @@ void setup_id(uint8_t my_id) {
|
|||
write_param(addr_id,my_id);
|
||||
}
|
||||
|
||||
void firmware_update(){
|
||||
write_param(firmw,FIRMWARE_FLAG);
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
void setup_angle(float target_angle) {
|
||||
motor.enable(); // Enable motor if disabled
|
||||
motor.controller = MotionControlType::angle;
|
||||
|
@ -142,6 +147,8 @@ void setup_pid_angle(uint8_t param_pid, float data){
|
|||
write_param(param_pid,data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void listen_can(const CAN_message_t &msg) {
|
||||
msg_id = msg.id;
|
||||
msg_ch = msg_id & 0xF; // Extract message channel
|
||||
|
@ -203,6 +210,10 @@ void listen_can(const CAN_message_t &msg) {
|
|||
conv_float_to_int.f = motor.P_angle.D;
|
||||
write_param(pid_d,conv_float_to_int.i);
|
||||
break;
|
||||
|
||||
case FIRMWARE_UPDATE:
|
||||
firmware_update();
|
||||
break;
|
||||
|
||||
case MOTOR_ENABLED:
|
||||
if (msg.buf[1] == 1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue