![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
smoothie port to mbed online compiler (smoothieware.org)
For documentation, license, ..., please check http://smoothieware.org/
This version has been tested with a 3 axis machine
modules/utils/currentcontrol/CurrentControl.cpp@0:31e91bb0ef3c, 2012-07-31 (annotated)
- Committer:
- scachat
- Date:
- Tue Jul 31 21:11:18 2012 +0000
- Revision:
- 0:31e91bb0ef3c
smoothie port to mbed online compiler
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
scachat | 0:31e91bb0ef3c | 1 | #include "libs/Kernel.h" |
scachat | 0:31e91bb0ef3c | 2 | #include "CurrentControl.h" |
scachat | 0:31e91bb0ef3c | 3 | #include "libs/nuts_bolts.h" |
scachat | 0:31e91bb0ef3c | 4 | #include "libs/utils.h" |
scachat | 0:31e91bb0ef3c | 5 | #include <string> |
scachat | 0:31e91bb0ef3c | 6 | using namespace std; |
scachat | 0:31e91bb0ef3c | 7 | |
scachat | 0:31e91bb0ef3c | 8 | CurrentControl::CurrentControl(){} |
scachat | 0:31e91bb0ef3c | 9 | |
scachat | 0:31e91bb0ef3c | 10 | void CurrentControl::on_module_loaded(){ |
scachat | 0:31e91bb0ef3c | 11 | if( !this->kernel->config->value( currentcontrol_module_enable_checksum )->by_default(false)->as_bool() ){ return; } |
scachat | 0:31e91bb0ef3c | 12 | |
scachat | 0:31e91bb0ef3c | 13 | // Get configuration |
scachat | 0:31e91bb0ef3c | 14 | this->alpha_current = this->kernel->config->value(alpha_current_checksum )->by_default(0.8)->as_number(); |
scachat | 0:31e91bb0ef3c | 15 | this->beta_current = this->kernel->config->value(beta_current_checksum )->by_default(0.8)->as_number(); |
scachat | 0:31e91bb0ef3c | 16 | this->gamma_current = this->kernel->config->value(gamma_current_checksum )->by_default(0.8)->as_number(); |
scachat | 0:31e91bb0ef3c | 17 | this->delta_current = this->kernel->config->value(delta_current_checksum )->by_default(0.8)->as_number(); |
scachat | 0:31e91bb0ef3c | 18 | |
scachat | 0:31e91bb0ef3c | 19 | this->kernel->digipot->set_current(0, this->alpha_current); |
scachat | 0:31e91bb0ef3c | 20 | this->kernel->digipot->set_current(1, this->beta_current ); |
scachat | 0:31e91bb0ef3c | 21 | this->kernel->digipot->set_current(2, this->gamma_current); |
scachat | 0:31e91bb0ef3c | 22 | this->kernel->digipot->set_current(3, this->delta_current); |
scachat | 0:31e91bb0ef3c | 23 | |
scachat | 0:31e91bb0ef3c | 24 | } |
scachat | 0:31e91bb0ef3c | 25 | |
scachat | 0:31e91bb0ef3c | 26 |