mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 16:55:20 +03:00
Merge branch '2.3.1' into 2.3
This commit is contained in:
commit
16ace5cb57
6 changed files with 21 additions and 16 deletions
|
@ -165,19 +165,21 @@ void displayTrims(uint8_t phase)
|
||||||
|
|
||||||
void drawSliders()
|
void drawSliders()
|
||||||
{
|
{
|
||||||
for (uint8_t i=NUM_STICKS; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; i++) {
|
for (uint8_t i = NUM_STICKS; i < NUM_STICKS + NUM_POTS + NUM_SLIDERS; i++) {
|
||||||
#if defined(PCBX9E)
|
#if defined(PCBX9E)
|
||||||
if (i < SLIDER1) continue; // TODO change and display more values
|
if (i < SLIDER1)
|
||||||
|
continue; // TODO change and display more values
|
||||||
coord_t x = ((i==SLIDER1 || i==SLIDER3) ? 3 : LCD_W-5);
|
coord_t x = ((i==SLIDER1 || i==SLIDER3) ? 3 : LCD_W-5);
|
||||||
int8_t y = (i<SLIDER3 ? LCD_H/2+1 : 1);
|
int8_t y = (i<SLIDER3 ? LCD_H/2+1 : 1);
|
||||||
#else
|
#else
|
||||||
if (i == POT3) continue;
|
if (i == POT3)
|
||||||
|
continue;
|
||||||
coord_t x = ((i==POT1 || i==SLIDER1) ? 3 : LCD_W-5);
|
coord_t x = ((i==POT1 || i==SLIDER1) ? 3 : LCD_W-5);
|
||||||
int8_t y = (i>=SLIDER1 ? LCD_H/2+1 : 1);
|
int8_t y = (i>=SLIDER1 ? LCD_H/2+1 : 1);
|
||||||
#endif
|
#endif
|
||||||
lcdDrawSolidVerticalLine(x, y, LCD_H/2-2);
|
lcdDrawSolidVerticalLine(x, y, LCD_H/2-2);
|
||||||
lcdDrawSolidVerticalLine(x+1, y, LCD_H/2-2);
|
lcdDrawSolidVerticalLine(x+1, y, LCD_H/2-2);
|
||||||
y += LCD_H/2-4;
|
y += LCD_H / 2 - 4;
|
||||||
y -= ((calibratedAnalogs[i]+RESX)*(LCD_H/2-4)/(RESX*2)); // calculate once per loop
|
y -= ((calibratedAnalogs[i]+RESX)*(LCD_H/2-4)/(RESX*2)); // calculate once per loop
|
||||||
lcdDrawSolidVerticalLine(x-1, y, 2);
|
lcdDrawSolidVerticalLine(x-1, y, 2);
|
||||||
lcdDrawSolidVerticalLine(x+2, y, 2);
|
lcdDrawSolidVerticalLine(x+2, y, 2);
|
||||||
|
|
|
@ -99,7 +99,7 @@ enum {
|
||||||
#if defined(HARDWARE_POT2)
|
#if defined(HARDWARE_POT2)
|
||||||
ITEM_RADIO_HARDWARE_POT2,
|
ITEM_RADIO_HARDWARE_POT2,
|
||||||
#endif
|
#endif
|
||||||
#if defined(HARDWARE_POT3)
|
#if defined(HARDWARE_POT3) || defined(PCBX9D) // TODO #if defined(STORAGE_POT3)
|
||||||
ITEM_RADIO_HARDWARE_POT3,
|
ITEM_RADIO_HARDWARE_POT3,
|
||||||
#endif
|
#endif
|
||||||
#if defined(HARDWARE_POT4)
|
#if defined(HARDWARE_POT4)
|
||||||
|
@ -194,6 +194,8 @@ enum {
|
||||||
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
||||||
#elif (NUM_POTS + NUM_SLIDERS) == 3
|
#elif (NUM_POTS + NUM_SLIDERS) == 3
|
||||||
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
||||||
|
#elif defined(PCBX9D) // TODO defined(STORAGE_POT3) && !defined(STORAGE_POT3)
|
||||||
|
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, HIDDEN_ROW, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
||||||
#elif (NUM_POTS + NUM_SLIDERS) == 4
|
#elif (NUM_POTS + NUM_SLIDERS) == 4
|
||||||
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
||||||
#elif (NUM_POTS + NUM_SLIDERS) == 5
|
#elif (NUM_POTS + NUM_SLIDERS) == 5
|
||||||
|
@ -474,7 +476,7 @@ void menuRadioHardware(event_t event)
|
||||||
{
|
{
|
||||||
int index = k - ITEM_RADIO_HARDWARE_SA;
|
int index = k - ITEM_RADIO_HARDWARE_SA;
|
||||||
int config = SWITCH_CONFIG(index);
|
int config = SWITCH_CONFIG(index);
|
||||||
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, MIXSRC_FIRST_SWITCH-MIXSRC_Rud+index+1, menuHorizontalPosition < 0 ? attr : 0);
|
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, MIXSRC_FIRST_SWITCH - MIXSRC_Rud + index + 1, menuHorizontalPosition < 0 ? attr : 0);
|
||||||
if (ZEXIST(g_eeGeneral.switchNames[index]) || (attr && s_editMode > 0 && menuHorizontalPosition == 0))
|
if (ZEXIST(g_eeGeneral.switchNames[index]) || (attr && s_editMode > 0 && menuHorizontalPosition == 0))
|
||||||
editName(HW_SETTINGS_COLUMN1, y, g_eeGeneral.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0);
|
editName(HW_SETTINGS_COLUMN1, y, g_eeGeneral.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0);
|
||||||
else
|
else
|
||||||
|
|
|
@ -311,7 +311,7 @@ getvalue_t getValue(mixsrc_t i)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
else if (i <= MIXSRC_LAST_POT+NUM_MOUSE_ANALOGS) {
|
else if (i <= MIXSRC_LAST_POT + NUM_MOUSE_ANALOGS) {
|
||||||
return calibratedAnalogs[i - MIXSRC_Rud];
|
return calibratedAnalogs[i - MIXSRC_Rud];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ void evalInputs(uint8_t mode)
|
||||||
{
|
{
|
||||||
BeepANACenter anaCenter = 0;
|
BeepANACenter anaCenter = 0;
|
||||||
|
|
||||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; i++) {
|
for (uint8_t i = 0; i < NUM_STICKS + NUM_POTS + NUM_SLIDERS; i++) {
|
||||||
// normalization [0..2048] -> [-1024..1024]
|
// normalization [0..2048] -> [-1024..1024]
|
||||||
uint8_t ch = (i < NUM_STICKS ? CONVERT_MODE(i) : i);
|
uint8_t ch = (i < NUM_STICKS ? CONVERT_MODE(i) : i);
|
||||||
int16_t v = anaIn(i);
|
int16_t v = anaIn(i);
|
||||||
|
|
|
@ -113,7 +113,7 @@ OpenTxSim::OpenTxSim(FXApp* a):
|
||||||
sliders[i]->setValue(0);
|
sliders[i]->setValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0; i<NUM_POTS+NUM_SLIDERS; i++){
|
for (int i = 0; i < NUM_POTS + NUM_SLIDERS; i++) {
|
||||||
knobs[i]= new FXKnob(hf11, nullptr, 0, KNOB_TICKS|LAYOUT_LEFT);
|
knobs[i]= new FXKnob(hf11, nullptr, 0, KNOB_TICKS|LAYOUT_LEFT);
|
||||||
knobs[i]->setValue(0);
|
knobs[i]->setValue(0);
|
||||||
|
|
||||||
|
@ -125,6 +125,7 @@ OpenTxSim::OpenTxSim(FXApp* a):
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
knobs[i]->setRange(-1024, 1024);
|
knobs[i]->setRange(-1024, 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +153,7 @@ OpenTxSim::~OpenTxSim()
|
||||||
delete sliders[2];
|
delete sliders[2];
|
||||||
delete sliders[3];
|
delete sliders[3];
|
||||||
|
|
||||||
for(int i=0; i<NUM_POTS+NUM_SLIDERS; i++){
|
for (int i = 0; i < NUM_POTS + NUM_SLIDERS; i++) {
|
||||||
delete knobs[i];
|
delete knobs[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,10 +522,10 @@ int main(int argc, char ** argv)
|
||||||
|
|
||||||
uint16_t anaIn(uint8_t chan)
|
uint16_t anaIn(uint8_t chan)
|
||||||
{
|
{
|
||||||
if (chan<NUM_STICKS)
|
if (chan < NUM_STICKS)
|
||||||
return opentxSim->sliders[chan]->getValue();
|
return opentxSim->sliders[chan]->getValue();
|
||||||
else if (chan<NUM_STICKS+NUM_POTS+NUM_SLIDERS)
|
else if (chan < NUM_STICKS + NUM_POTS + NUM_SLIDERS)
|
||||||
return opentxSim->knobs[chan-NUM_STICKS]->getValue();
|
return opentxSim->knobs[chan - NUM_STICKS]->getValue();
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
else if (chan == TX_RTC_VOLTAGE)
|
else if (chan == TX_RTC_VOLTAGE)
|
||||||
return 800; // 2.34V
|
return 800; // 2.34V
|
||||||
|
|
|
@ -38,14 +38,14 @@
|
||||||
9 /*TX_VOLTAGE*/, 10 /*TX_VBAT*/ };
|
9 /*TX_VOLTAGE*/, 10 /*TX_VBAT*/ };
|
||||||
#elif defined(PCBX9DP)
|
#elif defined(PCBX9DP)
|
||||||
const int8_t adcDirection[NUM_ANALOGS] = {1,-1,1,-1, 1,1,-1, 1,1, 1, 1};
|
const int8_t adcDirection[NUM_ANALOGS] = {1,-1,1,-1, 1,1,-1, 1,1, 1, 1};
|
||||||
|
#elif defined(PCBX9D)
|
||||||
|
const int8_t adcDirection[NUM_ANALOGS] = {1,-1,1,-1, 1,1,0, 1,1, 1, 1};
|
||||||
#elif defined(PCBX7)
|
#elif defined(PCBX7)
|
||||||
const int8_t adcDirection[NUM_ANALOGS] = {-1,1,-1,1, 1,1, 1, 1};
|
const int8_t adcDirection[NUM_ANALOGS] = {-1,1,-1,1, 1,1, 1, 1};
|
||||||
#elif defined(PCBX9LITE)
|
#elif defined(PCBX9LITE)
|
||||||
const int8_t adcDirection[NUM_ANALOGS] = {-1,1,-1,1, 1,1, 1};
|
const int8_t adcDirection[NUM_ANALOGS] = {-1,1,-1,1, 1,1, 1};
|
||||||
#elif defined(PCBXLITE)
|
#elif defined(PCBXLITE)
|
||||||
const int8_t adcDirection[NUM_ANALOGS] = {1,-1,-1,1, -1,1, 1, 1};
|
const int8_t adcDirection[NUM_ANALOGS] = {1,-1,-1,1, -1,1, 1, 1};
|
||||||
#else
|
|
||||||
const int8_t adcDirection[NUM_ANALOGS] = {1,-1,1,-1, 1,1,0, 1,1, 1, 1};
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if NUM_PWMSTICKS > 0
|
#if NUM_PWMSTICKS > 0
|
||||||
|
|
|
@ -504,7 +504,7 @@ enum Analogs {
|
||||||
#define STORAGE_NUM_POTS 3
|
#define STORAGE_NUM_POTS 3
|
||||||
#define STORAGE_NUM_SLIDERS 2
|
#define STORAGE_NUM_SLIDERS 2
|
||||||
#else
|
#else
|
||||||
#define NUM_POTS 2
|
#define NUM_POTS 3 // TODO X9D has only 2 pots
|
||||||
#define NUM_SLIDERS 2
|
#define NUM_SLIDERS 2
|
||||||
#define STORAGE_NUM_POTS 3
|
#define STORAGE_NUM_POTS 3
|
||||||
#define STORAGE_NUM_SLIDERS 2
|
#define STORAGE_NUM_SLIDERS 2
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue