frc2609 / rapid-react-robot-code-2022

Other
4 stars 2 forks source link

Using burnflash() modifies spark max configuration even when different code is uploaded #42

Closed UserC2 closed 2 years ago

UserC2 commented 2 years ago

burnflash() will permanently change the spark max's configuration even after the robot is powered off. This means that if you turn the robot off and change the code, it will still have that configuration unless it is configured again.

It probably shouldn't.

theyeeman commented 2 years ago

The PID code was copied from sample code we found. This forum post (https://www.chiefdelphi.com/t/rev-spark-max-burnflash-usage/376808) suggests that best practice is to call burnFlash() after applying changes so that the changes persist on a reboot. The forum also notes that the spark max controllers may have a limited write life, so this might be a problem?

To be honest, I'm not sure what the best practice is. I'm not even sure how useful the burnFlash() method is if we always initialize the variables in our init code (does the spark max take the configuration from our init code or from its own memory?)

UserC2 commented 2 years ago

That would be best practice as long as you wanted to keep those changes, but if we wanted to use the shooter for driver's training which currently doesn't use the PWM then we have to manually reconfigure the spark max every time we want to do driver's training.

UserC2 commented 2 years ago

Also, if they have a limited write flash then burning it every time the robot is power cycled is definitely not a good idea.

(What are they using that has a limited write life? EEPROMs were invented many decades ago...)

UserC2 commented 2 years ago

I'm not sure if you fixed this, but it does appear to work fine when I upload the practice code onto the robot.