Skip to content

Commit

Permalink
Merge pull request #59 from jieter/fix-setup
Browse files Browse the repository at this point in the history
Fix #56, increase raw values, not scaled ones.
  • Loading branch information
xnk committed Feb 25, 2015
2 parents fee538e + ba26cd1 commit e3022e5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ int Setup_getNumItems(void) {
return NUM_SETUP_ITEMS;
}

int _getRawValue(int item) {
return NV_GetConfig(setupmenu[item].nvval);
}

float Setup_getValue(int item) {
int intval = NV_GetConfig(setupmenu[item].nvval);
int intval = _getRawValue(item);
intval += setupmenu[item].offset;
return ((float)intval) * setupmenu[item].multiplier;
}
Expand All @@ -49,7 +53,7 @@ void Setup_setValue(int item, int value) {
}

void Setup_increaseValue(int item, int amount) {
int curval = Setup_getValue(item) + amount;
int curval = _getRawValue(item) + amount;

int maxval = setupmenu[item].maxval;
if (curval > maxval) curval = maxval;
Expand All @@ -58,7 +62,7 @@ void Setup_increaseValue(int item, int amount) {
}

void Setup_decreaseValue(int item, int amount) {
int curval = Setup_getValue(item) - amount;
int curval = _getRawValue(item) - amount;

int minval = setupmenu[item].minval;
if (curval < minval) curval = minval;
Expand Down

0 comments on commit e3022e5

Please sign in to comment.