Skip to content

Commit

Permalink
Modify data type of getIntV() and getExtV() to int32_t
Browse files Browse the repository at this point in the history
  • Loading branch information
TDA-2030 committed Jul 16, 2024
1 parent cf9be52 commit e8a1de2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
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);
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

0 comments on commit e8a1de2

Please sign in to comment.