Skip to content

Commit

Permalink
Small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
paulobarcelos committed Nov 24, 2015
1 parent cd3a7aa commit 1939c30
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ void Event::dispatch(float &value){
for(int i=0; i<typedInputHandlers.size(); i++){
(typedInputs[i]->*(typedInputHandlers[i]))(value);
}
}
}
5 changes: 4 additions & 1 deletion src/Input.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "Input.h"

Input::Input(){
node = NULL;
output = NULL;
value = 0;
}
Expand Down Expand Up @@ -36,7 +37,9 @@ void Input::handleOutputConnection(const Output &output){
}
void Input::onOutputChange(float value){
this->value = value;
if(node) node->onInternalInputChange(*this);
if(node != NULL){
node->onInternalInputChange(*this);
}
}
void Input::clearOutput(){
if(output){
Expand Down
6 changes: 3 additions & 3 deletions src/Input.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Input : public BaseInput{

Input();
~Input();

/**
* Handle for primitives connections.
**/
Expand All @@ -29,7 +29,7 @@ class Input : public BaseInput{

/**
* Getter
**/
**/
float get();

protected:
Expand All @@ -41,4 +41,4 @@ class Input : public BaseInput{
float value;
Output * output;
};
#endif
#endif
5 changes: 3 additions & 2 deletions src/Led.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ void Led::onInternalInputChange(BaseInput &internalInput){
}
isOn = false;
}

pwmCompare = (int)((float)Bot::INTERUPT_COUNT_OVERFLOW * pow(light.get(), 1.5));
else if(&internalInput == &light){
pwmCompare = (int)((float)Bot::INTERUPT_COUNT_OVERFLOW * pow(light.get(), 1.5));
}
}
volatile void Led::interruptUpdate(){
if(Bot::interruptCount < pwmCompare && !isOn){
Expand Down

0 comments on commit 1939c30

Please sign in to comment.