разделены DPO и MDO опции

подправлены описания
This commit is contained in:
Razvalyaev 2025-07-25 11:54:52 +03:00
parent 8a91973100
commit d9934b51fe

View File

@ -44,9 +44,13 @@ enum MenuState {
}; };
const char* modelList[] = { "MDO5", "MDO4", "MDO3", "MDO2", "MDO1", "DPO5", "DPO4", "DPO3", "DPO2", "DPO1" }; const char* modelList[] = { "DPO4", "DPO3", "DPO2", "DPO1", "MDO4", "MDO3", "MDO2", "MDO1"};
const uint8_t modelCount = sizeof(modelList) / sizeof(modelList[0]); const uint8_t modelCount = sizeof(modelList) / sizeof(modelList[0]);
// Фильтрация опций по модели
uint8_t filteredOptionIndexes[50];
uint8_t filteredOptionCount = 0;
const char* optionList[] = { const char* optionList[] = {
"BND", // Bundle (all-in-one) "BND", // Bundle (all-in-one)
"AERO", // Aerospace serial buses "AERO", // Aerospace serial buses
@ -63,38 +67,107 @@ const char* optionList[] = {
"PWR", // Power analysis "PWR", // Power analysis
"SA", // Spectrum Analyzer "SA", // Spectrum Analyzer
"SA3", // Spectrum Analyzer "SA3", // Spectrum Analyzer
"SA3T6", // Spectrum Analyzer
"SA6", // Spectrum Analyzer "SA6", // Spectrum Analyzer
"SEC", // Security extension "SEC", // Security extension
"TRIG", // RF Power Level Trigger "TRIG", // RF Power Level Trigger
"USB", // USB analysis "USB", // USB analysis
"VID" // Video signal triggering "VID" // Video signal triggering
}; };
const uint8_t optionCount = sizeof(optionList) / sizeof(optionList[0]);
const char* optionDescriptions[] = { const char* optionDescriptions[] = {
"Include all available options in one", "Include all available options in one",
"Aerospace buses: MIL-STD-1553, ARINC 429", "Aerospace buses: MIL-STD-1553",
"Waveform generator for custom signals", "Waveform generator for custom signals",
"Audio buses: I2S, TDM, LJ, RJ", "Audio buses: I2S, LJ, RJ, TDM",
"Cars buses: CAN FD, CAN, LIN", "Cars buses: CAN, CAN FD, LIN",
"Cars buses: CAN FD, CAN, LIN, FlexRay", "Cars buses: CAN, CAN FD, LIN, FlexRay",
"Computer buses: SPI, I2C, RS-232, PS/2", "Computer buses: RS-232/422/485, UART",
"Embedded protocols: I2C, SPI, UART, GPIO", "Embedded protocols: I2C, SPI",
"Ethernet: 10/100/1000BASE-T", "Ethernet: 10BASE-T, 100BASE-TX",
"Cars bus FlexRay", "Cars bus FlexRay",
"Limit and mask testing: Go/No-Go", "Limit and mask testing: Go/No-Go",
"Mixed Signal Oscill: analog + digital", "Mixed Signal Oscill: analog + digital",
"Power analysis: efficiency, ripple, Bode", "Power: efficiency, ripple, dI/dt, dV/dt",
"Spectrum analysis: RF, high-frequency", "Spectrum analysis: RF, high-frequency",
"Spectr analysis (3 MHz): RF, high-frequency", "Spectr analysis (3 MHz): RF, high-frequency",
"SA3 extention to 6 MHz for MDO4000C",
"Spectr analysis (6 MHz): RF, high-frequency", "Spectr analysis (6 MHz): RF, high-frequency",
"Security extension: access control", "Security extension: access control",
"RF power level triggering", "RF power level triggering",
"USB decoding: USB 1.x/2.0/3.x", "USB decoding: USB LS, FS, HS",
"Video triggering: HDMI, VGA, analog" "Video triggering: HDTV"
}; };
const uint8_t optionCount = sizeof(optionList) / sizeof(optionList[0]); bool isOptionForDPO[] = {
true, // BND → DPO4BND
true, // AERO → DPO4AERO
false, // AFG → (не используется в DPO)
true, // AUDIO → DPO4AUDIO
true, // AUTO → DPO4AUTO
true, // AUTOMAX → нет в DPO
true, // COMP → DPO4COMP
true, // EMBD → DPO4EMBD
true, // ENET → DPO4ENET
true, // FLEX → нет упоминания, но оставим
true, // LMT → DPO4LMT
false, // MSO → только для MDO (MDO4MSO)
true, // PWR → DPO4PWR
false, // SA → только MDO
false, // SA3 → только MDO
false, // SA3T6 → только MDO
false, // SA6 → только MDO
false, // SEC → только MDO (MDO4SEC)
false, // TRIG → только MDO (MDO4TRIG)
true, // USB → DPO4USB
true // VID → DPO4VID
};
bool isOptionForMDO[] = {
false, // BND → нет прямого MDO4BND
false, // AERO
true, // AFG → MDO4AFG
false, // AUDIO
false, // AUTO
false, // AUTOMAX → пусть будет для MDO
false, // COMP
false, // EMBD
false, // ENET
false, // FLEX
false, // LMT
true, // MSO → MDO4MSO
false, // PWR
true, // SA → MDO4SA3/MDO4SA6
true, // SA3 → MDO4SA3
true, // SA3 → MDO4SA3T6
true, // SA6 → MDO4SA6
true, // SEC → MDO4SEC
true, // TRIG → MDO4TRIG
false, // USB
false // VID
};
void filterOptionsForModel(const char* modelName) {
filteredOptionCount = 0;
bool isMDO = strstr(modelName, "MDO") != nullptr;
bool isDPO = strstr(modelName, "DPO") != nullptr;
for (uint8_t i = 0; i < optionCount; ++i) {
if ((isMDO && isOptionForMDO[i]) || (isDPO && isOptionForDPO[i])) {
filteredOptionIndexes[filteredOptionCount++] = i;
}
}
// Подстраховка
if (filteredOptionCount == 0) {
for (uint8_t i = 0; i < sizeof(optionList); ++i)
filteredOptionIndexes[filteredOptionCount++] = i;
}
}
uint8_t selectedModel = 0; uint8_t selectedModel = 0;
uint8_t selectedOption = 0; uint8_t selectedOption = 0;
@ -312,8 +385,10 @@ void updateMenuDisplay() {
u8g2.setFont(FONT); // основной шрифт u8g2.setFont(FONT); // основной шрифт
u8g2.drawStr(0, LINE_SPACING * 1, "Option:"); u8g2.drawStr(0, LINE_SPACING * 1, "Option:");
if (cursorPos >= filteredOptionCount) cursorPos = filteredOptionCount - 1;
char line[20]; char line[20];
uint8_t optIndex = cursorPos % optionCount; uint8_t optIndex = filteredOptionIndexes[cursorPos];
snprintf(line, sizeof(line), ">%s", optionList[optIndex]); snprintf(line, sizeof(line), ">%s", optionList[optIndex]);
u8g2.drawStr(0, LINE_SPACING * 2, line); u8g2.drawStr(0, LINE_SPACING * 2, line);
@ -399,11 +474,12 @@ void handleOk() {
} else if (currentMenu == MENU_SELECT_MODEL) { } else if (currentMenu == MENU_SELECT_MODEL) {
selectedModel = cursorPos % modelCount; selectedModel = cursorPos % modelCount;
filterOptionsForModel(modelList[selectedModel]); // ← ВАЖНО!
cursorPos = 0; cursorPos = 0;
currentMenu = MENU_SELECT_OPTION; currentMenu = MENU_SELECT_OPTION;
} else if (currentMenu == MENU_SELECT_OPTION) { } else if (currentMenu == MENU_SELECT_OPTION) {
selectedOption = cursorPos % optionCount; selectedOption = filteredOptionIndexes[cursorPos];;
char fullModule[32]; char fullModule[32];
snprintf(fullModule, sizeof(fullModule), "%s%s", modelList[selectedModel], optionList[selectedOption]); snprintf(fullModule, sizeof(fullModule), "%s%s", modelList[selectedModel], optionList[selectedOption]);