Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: modify return type of getIntV() and getExtV() to int32_t #111

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Firmware/FFBoard/Inc/voltagesense.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#define VOLTAGESENSE_H_
#include "target_constants.h"

uint16_t getIntV();
uint16_t getExtV();
int32_t getIntV();
int32_t getExtV();
void brakeCheck();

/*
Expand Down
2 changes: 1 addition & 1 deletion Firmware/FFBoard/Src/SerialFFB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void SerialFFB::set_gain(uint8_t gain){
* Returns the index where the effect was created or -1 if it can not be created
*/
int32_t SerialFFB::newEffect(uint8_t effectType){
uint32_t idx = this->effects_calc->find_free_effect(effectType);
int32_t idx = this->effects_calc->find_free_effect(effectType);
TDA-2030 marked this conversation as resolved.
Show resolved Hide resolved
if(idx >= 0){
// Allocate effect
effects[idx].type = effectType;
Expand Down
8 changes: 4 additions & 4 deletions Firmware/FFBoard/Src/voltagesense.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@ void setupBrakePin(uint32_t vdiffAct,uint32_t vdiffDeact,uint32_t vMax){
voltageDiffDeactivate = vdiffDeact;
}

uint16_t getIntV(){
int32_t getIntV(){
return VSENSE_ADC_BUF[ADC_CHAN_VINT] * vSenseMult;
}

uint16_t getExtV(){
int32_t getExtV(){
return VSENSE_ADC_BUF[ADC_CHAN_VEXT] * vSenseMult;
}

void brakeCheck(){
if(maxVoltage == 0 || brake_failure){
return;
}
uint16_t vint = getIntV();
uint16_t vext = getExtV();
int32_t vint = getIntV();
int32_t vext = getExtV();

if(vint < minVoltage && vext < minVoltage){
return; // Do not enable if device is unpowered (just measuring usb leakage)
Expand Down
2 changes: 1 addition & 1 deletion Firmware/FFBoard/UserExtensions/Src/TMC4671.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void TMC4671::restoreFlash(){
}

bool TMC4671::hasPower(){
uint16_t intV = getIntV();
int32_t intV = getIntV();
return (intV > 10000) && (getExtV() > 10000) && (intV < 78000);
}

Expand Down
Loading