Move fix to a better place
This commit is contained in:
@@ -58,7 +58,7 @@ void drawTrims(uint8_t flightMode)
|
|||||||
drawVerticalSlider(xm, TRIM_V_Y, 160, trim, TRIM_EXTENDED_MIN, TRIM_EXTENDED_MAX, 0, OPTION_SLIDER_EMPTY_BAR|OPTION_SLIDER_TRIM_BUTTON);
|
drawVerticalSlider(xm, TRIM_V_Y, 160, trim, TRIM_EXTENDED_MIN, TRIM_EXTENDED_MAX, 0, OPTION_SLIDER_EMPTY_BAR|OPTION_SLIDER_TRIM_BUTTON);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
drawVerticalSlider(xm, TRIM_V_Y, 160, limit(TRIM_MIN, trim, TRIM_MAX), TRIM_MIN, TRIM_MAX, 0, OPTION_SLIDER_EMPTY_BAR|OPTION_SLIDER_TRIM_BUTTON);
|
drawVerticalSlider(xm, TRIM_V_Y, 160, trim, TRIM_MIN, TRIM_MAX, 0, OPTION_SLIDER_EMPTY_BAR|OPTION_SLIDER_TRIM_BUTTON);
|
||||||
}
|
}
|
||||||
if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) {
|
if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) {
|
||||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||||
@@ -72,7 +72,7 @@ void drawTrims(uint8_t flightMode)
|
|||||||
drawHorizontalSlider(xm, TRIM_H_Y, 160, trim, TRIM_EXTENDED_MIN, TRIM_EXTENDED_MAX, 0, OPTION_SLIDER_EMPTY_BAR|OPTION_SLIDER_TRIM_BUTTON);
|
drawHorizontalSlider(xm, TRIM_H_Y, 160, trim, TRIM_EXTENDED_MIN, TRIM_EXTENDED_MAX, 0, OPTION_SLIDER_EMPTY_BAR|OPTION_SLIDER_TRIM_BUTTON);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
drawHorizontalSlider(xm, TRIM_H_Y, 160, limit(TRIM_MIN, trim, TRIM_MAX), TRIM_MIN, TRIM_MAX, 0, OPTION_SLIDER_EMPTY_BAR|OPTION_SLIDER_TRIM_BUTTON);
|
drawHorizontalSlider(xm, TRIM_H_Y, 160, trim, TRIM_MIN, TRIM_MAX, 0, OPTION_SLIDER_EMPTY_BAR|OPTION_SLIDER_TRIM_BUTTON);
|
||||||
}
|
}
|
||||||
if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) {
|
if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) {
|
||||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ void drawVerticalTrimPosition(coord_t x, coord_t y, int16_t dir)
|
|||||||
|
|
||||||
void drawVerticalSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options)
|
void drawVerticalSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options)
|
||||||
{
|
{
|
||||||
|
val = limit(min, val, max);
|
||||||
if (steps) {
|
if (steps) {
|
||||||
int delta = len / steps;
|
int delta = len / steps;
|
||||||
for (int i = 0; i <= len; i += delta) {
|
for (int i = 0; i <= len; i += delta) {
|
||||||
@@ -244,6 +245,7 @@ void drawVerticalSlider(coord_t x, coord_t y, int len, int val, int min, int max
|
|||||||
|
|
||||||
void drawHorizontalSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options)
|
void drawHorizontalSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options)
|
||||||
{
|
{
|
||||||
|
val = limit(min, val, max);
|
||||||
int w = divRoundClosest(len * (val - min), max - min);
|
int w = divRoundClosest(len * (val - min), max - min);
|
||||||
if (options & OPTION_SLIDER_TICKS) {
|
if (options & OPTION_SLIDER_TICKS) {
|
||||||
if (steps) {
|
if (steps) {
|
||||||
|
|||||||
Reference in New Issue
Block a user