Skip to content

Commit

Permalink
Fix data types in adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
pmattila committed Jun 20, 2024
1 parent 47f513f commit 71c7bbe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 13 additions & 5 deletions src/main/fc/rc_adjustments.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,13 @@ static const adjustmentConfig_t adjustmentConfigs[ADJUSTMENT_FUNCTION_COUNT] =
};


static int getAdjustmentValue(uint8_t adjFunc)
static int getAdjustmentValue(adjustmentFunc_e adjFunc)
{
int value = 0;

switch (adjFunc) {
case ADJUSTMENT_NONE:
break;
case ADJUSTMENT_RATE_PROFILE:
value = getCurrentControlRateProfileIndex() + 1;
break;
Expand Down Expand Up @@ -367,14 +369,18 @@ static int getAdjustmentValue(uint8_t adjFunc)
case ADJUSTMENT_ACC_TRIM_ROLL:
value = accelerometerConfig()->accelerometerTrims.values.roll;
break;
case ADJUSTMENT_FUNCTION_COUNT:
break;
}

return value;
}

static void setAdjustmentValue(uint8_t adjFunc, int value)
static void setAdjustmentValue(adjustmentFunc_e adjFunc, int value)
{
switch (adjFunc) {
case ADJUSTMENT_NONE:
break;
case ADJUSTMENT_RATE_PROFILE:
changeControlRateProfile(value - 1);
break;
Expand Down Expand Up @@ -574,10 +580,12 @@ static void setAdjustmentValue(uint8_t adjFunc, int value)
case ADJUSTMENT_ACC_TRIM_ROLL:
accelerometerConfigMutable()->accelerometerTrims.values.roll = value;
break;
case ADJUSTMENT_FUNCTION_COUNT:
break;
}
}

static void blackboxAdjustmentEvent(uint8_t adjFunc, int value)
static void blackboxAdjustmentEvent(adjustmentFunc_e adjFunc, int value)
{
#ifndef USE_BLACKBOX
UNUSED(adjFunc);
Expand All @@ -595,7 +603,7 @@ static void blackboxAdjustmentEvent(uint8_t adjFunc, int value)

#define ADJUSTMENT_LATENCY_MS 3000

static void updateAdjustmentData(uint8_t adjFunc, int value)
static void updateAdjustmentData(adjustmentFunc_e adjFunc, int value)
{
const timeMs_t now = millis();

Expand All @@ -622,7 +630,7 @@ static void updateAdjustmentData(uint8_t adjFunc, int value)

void processRcAdjustments(void)
{
uint8_t changed = 0;
bitmap_t changed = 0;

if (rxIsReceivingSignal())
{
Expand Down
2 changes: 1 addition & 1 deletion src/main/fc/rc_adjustments.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ typedef enum {
ADJUSTMENT_ACC_TRIM_ROLL = 65,

ADJUSTMENT_FUNCTION_COUNT
} adjustmentFunction_e;
} adjustmentFunc_e;

typedef enum {
ADJUSTMENT_TYPE_NONE = 0,
Expand Down

0 comments on commit 71c7bbe

Please sign in to comment.