feat: More flexible ADC inputs (#3870)

Co-authored-by: 3djc <lesitewebdejc@hotmail.com>
Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
Co-authored-by: philmoz <phil.a.mitchell@gmail.com>
This commit is contained in:
Raphael Coeffic
2023-11-02 11:07:53 +10:00
committed by GitHub
co-authored by 3djc Peter Feerick philmoz
parent f5593c44e8
commit b48e07026d
78 changed files with 1291 additions and 773 deletions
+5 -5
View File
@@ -538,7 +538,7 @@ void menuModelSetup(event_t event)
SW_WARN_ROWS, // ITEM_MODEL_SETUP_SWITCHES_WARNING1
POT_WARN_ROWS, // ITEM_MODEL_SETUP_POTS_WARNING
uint8_t(NAVIGATION_LINE_BY_LINE | (adcGetInputOffset(ADC_INPUT_POT + 1) - 1)), // ITEM_MODEL_SETUP_BEEP_CENTER
uint8_t(NAVIGATION_LINE_BY_LINE | (adcGetInputOffset(ADC_INPUT_FLEX + 1) - 1)), // ITEM_MODEL_SETUP_BEEP_CENTER
0, // ITEM_MODEL_SETUP_USE_JITTER_FILTER
@@ -977,7 +977,7 @@ void menuModelSetup(event_t event)
}
if (g_model.potsWarnMode) {
coord_t x = MODEL_SETUP_2ND_COLUMN+28;
uint8_t max_pots = adcGetMaxInputs(ADC_INPUT_POT);
uint8_t max_pots = adcGetMaxInputs(ADC_INPUT_FLEX);
for (int i = 0; i < max_pots; ++i) {
if (!IS_POT_SLIDER_AVAILABLE(i)) {
@@ -1011,8 +1011,8 @@ void menuModelSetup(event_t event)
case ITEM_MODEL_SETUP_BEEP_CENTER: {
lcdDrawTextAlignedLeft(y, STR_BEEPCTR);
uint8_t pot_offset = adcGetInputOffset(ADC_INPUT_POT);
uint8_t max_inputs = adcGetMaxInputs(ADC_INPUT_MAIN) + adcGetMaxInputs(ADC_INPUT_POT);
uint8_t pot_offset = adcGetInputOffset(ADC_INPUT_FLEX);
uint8_t max_inputs = adcGetMaxInputs(ADC_INPUT_MAIN) + adcGetMaxInputs(ADC_INPUT_FLEX);
coord_t x = MODEL_SETUP_2ND_COLUMN;
for (uint8_t i = 0; i < max_inputs; i++) {
if ( i >= pot_offset && IS_POT_MULTIPOS(i - pot_offset) ) {
@@ -1024,7 +1024,7 @@ void menuModelSetup(event_t event)
flags = BLINK | INVERS;
else if (ANALOG_CENTER_BEEP(i) || (attr && CURSOR_ON_LINE()))
flags = INVERS;
if (adcGetMaxInputs(ADC_INPUT_POT) > 4 || i < pot_offset) {
if (adcGetMaxInputs(ADC_INPUT_FLEX) > 4 || i < pot_offset) {
lcdDrawText(x, y, getAnalogShortLabel(i), flags);
}
else {
+2 -2
View File
@@ -31,8 +31,8 @@
void drawPotsBars()
{
// Optimization by Mike Blandford
uint8_t max_pots = adcGetMaxInputs(ADC_INPUT_POT);
uint8_t offset = adcGetInputOffset(ADC_INPUT_POT);
uint8_t max_pots = adcGetMaxInputs(ADC_INPUT_FLEX);
uint8_t offset = adcGetInputOffset(ADC_INPUT_FLEX);
for (uint8_t x = LCD_W / 2 - max_pots / 2 * BAR_SPACING + BAR_SPACING / 2,
i = 0;
+4 -4
View File
@@ -183,8 +183,8 @@ static const coord_t _pot_slots[] = {
void drawSliders()
{
uint8_t slot_idx = 0;
uint8_t max_pots = adcGetMaxInputs(ADC_INPUT_POT);
uint8_t offset = adcGetInputOffset(ADC_INPUT_POT);
uint8_t max_pots = adcGetMaxInputs(ADC_INPUT_FLEX);
uint8_t offset = adcGetInputOffset(ADC_INPUT_FLEX);
for (uint8_t i = 0; i < max_pots; i++) {
@@ -534,7 +534,7 @@ void menuMainView(event_t event)
uint8_t switches = switchGetMaxSwitches();
if (getSwitchCount() > 16) { // beware, there is a desired col/row swap in this special mode
for (int i = 0; i < switches; ++i) {
if (SWITCH_EXISTS(i)) {
if (SWITCH_EXISTS(i) && !switchIsFlex(i)) {
auto switch_display = switchGetDisplayPosition(i);
if (g_model.view == VIEW_INPUTS) {
coord_t x = 50 + (switch_display.row % 5) * 4 +
@@ -552,7 +552,7 @@ void menuMainView(event_t event)
else {
coord_t shiftright = switchGetMaxRow(1) < 4 ? 20 : 0;
for (int i = 0; i < switches; ++i) {
if (SWITCH_EXISTS(i)) {
if (SWITCH_EXISTS(i) && !switchIsFlex(i)) {
auto switch_display = switchGetDisplayPosition(i);
if (g_model.view == VIEW_INPUTS) {
coord_t x = (switch_display.col == 0 ? 50 : 125) +