PushToGo on STM32F429-Disco Board
Dependencies: BSP_DISCO_F429ZI LCD_DISCO_F429ZI pushtogo usb
AdaptiveAxis.cpp@8:f0455a1d4709, 2018-09-23 (annotated)
- Committer:
- caoyu@caoyuan9642-desktop.MIT.EDU
- Date:
- Sun Sep 23 02:31:28 2018 -0400
- Revision:
- 8:f0455a1d4709
- Parent:
- 1:64c1fd738059
merge
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
caoyuan9642 | 1:64c1fd738059 | 1 | /* |
caoyuan9642 | 1:64c1fd738059 | 2 | * AdaptiveAxis.cpp |
caoyuan9642 | 1:64c1fd738059 | 3 | * |
caoyuan9642 | 1:64c1fd738059 | 4 | * Created on: 2018Äê2ÔÂ24ÈÕ |
caoyuan9642 | 1:64c1fd738059 | 5 | * Author: caoyuan9642 |
caoyuan9642 | 1:64c1fd738059 | 6 | */ |
caoyuan9642 | 1:64c1fd738059 | 7 | |
caoyuan9642 | 1:64c1fd738059 | 8 | #include <AdaptiveAxis.h> |
caoyuan9642 | 1:64c1fd738059 | 9 | |
caoyuan9642 | 1:64c1fd738059 | 10 | void AdaptiveAxis::slew_mode() |
caoyuan9642 | 1:64c1fd738059 | 11 | { |
caoyuan9642 | 1:64c1fd738059 | 12 | this->stepper->poweron(); |
caoyuan9642 | 1:64c1fd738059 | 13 | this->stepper->setMicroStep( |
caoyuan9642 | 1:64c1fd738059 | 14 | TelescopeConfiguration::getInt("microstep_slew")); |
caoyuan9642 | 1:64c1fd738059 | 15 | this->stepper->setCurrent( |
caoyuan9642 | 1:64c1fd738059 | 16 | TelescopeConfiguration::getDouble("current_slew")); |
caoyuan9642 | 1:64c1fd738059 | 17 | } |
caoyuan9642 | 1:64c1fd738059 | 18 | |
caoyuan9642 | 1:64c1fd738059 | 19 | void AdaptiveAxis::track_mode() |
caoyuan9642 | 1:64c1fd738059 | 20 | { |
caoyuan9642 | 1:64c1fd738059 | 21 | this->stepper->poweron(); |
caoyuan9642 | 1:64c1fd738059 | 22 | this->stepper->setMicroStep( |
caoyuan9642 | 1:64c1fd738059 | 23 | TelescopeConfiguration::getInt("microstep_track")); |
caoyuan9642 | 1:64c1fd738059 | 24 | this->stepper->setCurrent( |
caoyuan9642 | 1:64c1fd738059 | 25 | TelescopeConfiguration::getDouble("current_track")); |
caoyuan9642 | 1:64c1fd738059 | 26 | } |
caoyuan9642 | 1:64c1fd738059 | 27 | |
caoyuan9642 | 1:64c1fd738059 | 28 | void AdaptiveAxis::correction_mode() |
caoyuan9642 | 1:64c1fd738059 | 29 | { |
caoyuan9642 | 1:64c1fd738059 | 30 | this->stepper->poweron(); |
caoyuan9642 | 1:64c1fd738059 | 31 | this->stepper->setMicroStep( |
caoyuan9642 | 1:64c1fd738059 | 32 | TelescopeConfiguration::getInt("microstep_correction")); |
caoyuan9642 | 1:64c1fd738059 | 33 | this->stepper->setCurrent( |
caoyuan9642 | 1:64c1fd738059 | 34 | TelescopeConfiguration::getDouble("current_correction")); |
caoyuan9642 | 1:64c1fd738059 | 35 | } |
caoyuan9642 | 1:64c1fd738059 | 36 | |
caoyuan9642 | 1:64c1fd738059 | 37 | void AdaptiveAxis::idle_mode() |
caoyuan9642 | 1:64c1fd738059 | 38 | { |
caoyuan9642 | 1:64c1fd738059 | 39 | double idle_current = TelescopeConfiguration::getDouble("current_idle"); |
caoyuan9642 | 1:64c1fd738059 | 40 | if (idle_current != 0) |
caoyuan9642 | 1:64c1fd738059 | 41 | this->stepper->setCurrent(idle_current); |
caoyuan9642 | 1:64c1fd738059 | 42 | else |
caoyuan9642 | 1:64c1fd738059 | 43 | this->stepper->poweroff(); |
caoyuan9642 | 1:64c1fd738059 | 44 | } |
caoyuan9642 | 1:64c1fd738059 | 45 |