The codebase to run the *spark d-fuser controller www.sparkav.co.uk/dvimixer
Dependencies: SPK-TVOne DMX DmxArtNet NetServicesMin OSC PinDetect mRotaryEncoder iniparser mbed spk_oled_ssd1305 filter
Diff: main.cpp
- Revision:
- 53:0993424e1529
- Parent:
- 52:98f557fe93a3
- Child:
- 54:e8606eaa47a3
--- a/main.cpp Tue Dec 18 16:44:55 2012 +0000 +++ b/main.cpp Wed Dec 19 14:35:00 2012 +0000 @@ -767,7 +767,7 @@ void troubleshootingMenuHDCPHandler(int change, bool action) { static int currentHDCP; - static unsigned int state = 1; + static int state = 0; if (change == 0 && !action) { @@ -799,19 +799,21 @@ } state += change; + if (state > 1) state = 1; + if (state < 0) state = 0; char paramLine[kStringBufferLength]; screen.clearBufferRow(kMenuLine2); const char* current = currentHDCP == -1 ? "Mixed" : ( currentHDCP == 1 ? "On" : "Off"); - if (state % 2) snprintf(paramLine, kStringBufferLength, "%s. Set: [%s/ ]?", current, currentHDCP == 0 ? "On " : "Off" ); + if (state == 0) snprintf(paramLine, kStringBufferLength, "%s. Set: [%s/ ]?", current, currentHDCP == 0 ? "On " : "Off" ); else snprintf(paramLine, kStringBufferLength, "%s. Set: [ /Cancel]?", current); screen.textToBuffer(paramLine, kMenuLine2); if (action) { - if (state % 2) + if (state == 0) { screen.clearBufferRow(kTVOneStatusLine); screen.textToBuffer("Setting HDCP...", kTVOneStatusLine); @@ -841,7 +843,7 @@ void troubleshootingMenuEDIDHandler(int change, bool action) { static int currentEDIDPassthrough; - static unsigned int state = 1; + static int state = 0; if (change == 0 && !action) { @@ -866,19 +868,21 @@ } state += change; + if (state > 1) state = 1; + if (state < 0) state = 0; char paramLine[kStringBufferLength]; screen.clearBufferRow(kMenuLine2); const char* current = currentEDIDPassthrough == -1 ? "Mixed" : ( currentEDIDPassthrough == 1 ? "Thru" : "Internal"); - if (state % 2) snprintf(paramLine, kStringBufferLength, "%s. Set: [%s/ ]?", current, currentEDIDPassthrough == 0 ? "Thru" : "Int"); + if (state == 0) snprintf(paramLine, kStringBufferLength, "%s. Set: [%s/ ]?", current, currentEDIDPassthrough == 0 ? "Thru" : "Int"); else snprintf(paramLine, kStringBufferLength, "%s. Set: [ /Cancel]?", current); screen.textToBuffer(paramLine, kMenuLine2); if (action) { - if (state % 2) + if (state == 0) { screen.clearBufferRow(kTVOneStatusLine); screen.textToBuffer("Setting EDID...", kTVOneStatusLine); @@ -915,7 +919,7 @@ void mixModeUpdateKeyMenuHandler(int menuChange, bool action) { static int actionCount = 0; - static unsigned int state = 0; + static int state = 0; if (action) actionCount++; @@ -926,7 +930,10 @@ screen.textToBuffer("Edit current key?", kMenuLine1); state += menuChange; - switch (state % 3) + if (state > 2) state = 2; + if (state < 0) state = 0; + + switch (state) { case 0: screen.textToBuffer("[Tweak/ / ]", kMenuLine2); break; case 1: screen.textToBuffer("[ /Start Over/ ]", kMenuLine2); break; @@ -935,8 +942,6 @@ } if (actionCount == 1) { - state = state % 3; - if (state == 0) { settings.editingKeyerSetIndex = mixModeMenu.selectedIndex() - mixKeyStartIndex; @@ -1116,7 +1121,7 @@ void troubleshootingMenuResetHandler(int menuChange, bool action) { static int actionCount = 0; - static unsigned int state = 0; + static int state = 0; if (action) actionCount++; @@ -1125,7 +1130,10 @@ screen.clearBufferRow(kMenuLine2); state += menuChange; - switch (state % 2) + if (state > 1) state = 1; + if (state < 0) state = 0; + + switch (state) { case 0: screen.textToBuffer("1. Controller [Reset/ ]", kMenuLine2); break; case 1: screen.textToBuffer("1. Controller [ /Skip]", kMenuLine2); break; @@ -1133,8 +1141,6 @@ } if (actionCount == 1) { - state = state % 2; - if (state == 0) { tvOneRGB1Stable = false; @@ -1165,7 +1171,9 @@ screen.clearBufferRow(kMenuLine2); state += menuChange; - switch (state % 2) + if (state > 1) state = 1; + if (state < 0) state = 0; + switch (state) { case 0: screen.textToBuffer("2. Processor [Reset/ ]", kMenuLine2); break; case 1: screen.textToBuffer("2. Processor [ /Skip]", kMenuLine2); break; @@ -1173,8 +1181,6 @@ } if (actionCount == 3) { - state = state % 2; - if (state == 0) { screen.clearBufferRow(kMenuLine2);