Skip to content

Commit

Permalink
Merge pull request #11 from srobo/motor-get-fix
Browse files Browse the repository at this point in the history
Fix overflow in storing motor power value
  • Loading branch information
WillB97 authored Aug 27, 2023
2 parents c66ce66 + 969cf1e commit 96bd804
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
## You should have received a copy of the GNU Lesser General Public License
## along with this library. If not, see <http://www.gnu.org/licenses/>.
##
FW_VER ?= 4.4
FW_VER ?= 4.4.1

# Name of C file with main function
BINARY = main
Expand Down
2 changes: 1 addition & 1 deletion src/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ bool output_enabled(uint8_t output_num) {
return output_data[output_num].enabled;
}

int8_t output_get_output(uint8_t output_num) {
int16_t output_get_output(uint8_t output_num) {
if (!(output_num < NUM_OUTPUTS)) {
// skip invalid output numbers
return 0;
Expand Down
4 changes: 2 additions & 2 deletions src/output.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

typedef struct {
bool enabled;
int8_t value;
int16_t value;
bool in_fault;
uint16_t current;
} output_t;
Expand All @@ -20,7 +20,7 @@ void output_init(void);

void output_set_power(uint8_t output_num, int16_t output_val);
bool output_enabled(uint8_t output_num);
int8_t output_get_output(uint8_t output_num);
int16_t output_get_output(uint8_t output_num);
void output_disable(uint8_t output_num);
uint16_t output_get_current(uint8_t output_num);
void check_output_faults(void);
Expand Down

0 comments on commit 96bd804

Please sign in to comment.