smoothie port to mbed online compiler (smoothieware.org)

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CurrentControl.cpp Source File

CurrentControl.cpp

00001 #include "libs/Kernel.h"
00002 #include "CurrentControl.h"
00003 #include "libs/nuts_bolts.h"
00004 #include "libs/utils.h"
00005 #include <string>
00006 using namespace std;
00007 
00008 CurrentControl::CurrentControl(){}
00009 
00010 void CurrentControl::on_module_loaded(){
00011     if( !this->kernel->config->value( currentcontrol_module_enable_checksum )->by_default(false)->as_bool() ){ return; } 
00012 
00013     // Get configuration
00014     this->alpha_current =           this->kernel->config->value(alpha_current_checksum  )->by_default(0.8)->as_number(); 
00015     this->beta_current  =           this->kernel->config->value(beta_current_checksum   )->by_default(0.8)->as_number(); 
00016     this->gamma_current =           this->kernel->config->value(gamma_current_checksum  )->by_default(0.8)->as_number(); 
00017     this->delta_current =           this->kernel->config->value(delta_current_checksum  )->by_default(0.8)->as_number();
00018 
00019     this->kernel->digipot->set_current(0, this->alpha_current);
00020     this->kernel->digipot->set_current(1, this->beta_current );
00021     this->kernel->digipot->set_current(2, this->gamma_current);
00022     this->kernel->digipot->set_current(3, this->delta_current);
00023 
00024 }
00025 
00026