![](/media/cache/profiles/89a26a363b87a87ac6a94277e841b7f4.50x50_q85.jpg)
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
main.cpp@37:744bef2e8be8, 2012-11-06 (annotated)
- Committer:
- tobyspark
- Date:
- Tue Nov 06 03:47:11 2012 +0000
- Revision:
- 37:744bef2e8be8
- Parent:
- 36:8b5c75c8bc23
- Child:
- 38:2701101dcd56
Debug off
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tobyspark | 8:d46cc49f0f37 | 1 | /* *SPARK D-FUSER |
tobyspark | 8:d46cc49f0f37 | 2 | * A project by Toby Harris |
tobyspark | 8:d46cc49f0f37 | 3 | * |
tobyspark | 8:d46cc49f0f37 | 4 | * 'DJ' controller styke RS232 Control for TV-One products |
tobyspark | 8:d46cc49f0f37 | 5 | * Good for 1T-C2-750, others will need some extra work |
tobyspark | 8:d46cc49f0f37 | 6 | * |
tobyspark | 8:d46cc49f0f37 | 7 | * www.sparkav.co.uk/dvimixer |
tobyspark | 8:d46cc49f0f37 | 8 | */ |
tobyspark | 0:87aab40d5806 | 9 | |
tobyspark | 8:d46cc49f0f37 | 10 | /* Copyright (c) 2011 Toby Harris, MIT License |
tobyspark | 8:d46cc49f0f37 | 11 | * |
tobyspark | 8:d46cc49f0f37 | 12 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
tobyspark | 8:d46cc49f0f37 | 13 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
tobyspark | 8:d46cc49f0f37 | 14 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
tobyspark | 8:d46cc49f0f37 | 15 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
tobyspark | 8:d46cc49f0f37 | 16 | * furnished to do so, subject to the following conditions: |
tobyspark | 8:d46cc49f0f37 | 17 | * |
tobyspark | 8:d46cc49f0f37 | 18 | * The above copyright notice and this permission notice shall be included in all copies or |
tobyspark | 8:d46cc49f0f37 | 19 | * substantial portions of the Software. |
tobyspark | 8:d46cc49f0f37 | 20 | * |
tobyspark | 8:d46cc49f0f37 | 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
tobyspark | 8:d46cc49f0f37 | 22 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
tobyspark | 8:d46cc49f0f37 | 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
tobyspark | 8:d46cc49f0f37 | 24 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
tobyspark | 8:d46cc49f0f37 | 25 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
tobyspark | 8:d46cc49f0f37 | 26 | */ |
tobyspark | 8:d46cc49f0f37 | 27 | |
tobyspark | 8:d46cc49f0f37 | 28 | /* ROADMAP / HISTORY |
tobyspark | 8:d46cc49f0f37 | 29 | * v10 - Port to mBed, keying redux - Apr'11 |
tobyspark | 8:d46cc49f0f37 | 30 | * v11 - Sign callbacks, code clean-up - Apr'11 |
tobyspark | 8:d46cc49f0f37 | 31 | * v12 - TVOne header split into two: defines and mbed class. v002 header updates pulled down. Removed sign callbacks, rewrite of debug and signing. - Apr'11 |
tobyspark | 8:d46cc49f0f37 | 32 | * v13 - Menu system for Resolution + Keying implemented, it writing to debug, it sending TVOne commands - Apr'11 |
tobyspark | 8:d46cc49f0f37 | 33 | * v14 - Fixes for new PCB - Oct'11 |
tobyspark | 8:d46cc49f0f37 | 34 | * v15 - TBZ PCB, OLED - Mar'12 |
tobyspark | 8:d46cc49f0f37 | 35 | * v16 - Comms menu, OSC, ArtNet - April'12 |
tobyspark | 8:d46cc49f0f37 | 36 | * v17 - RJ45 - May'12 |
tobyspark | 8:d46cc49f0f37 | 37 | * v18 - DMX - July'12 |
tobyspark | 13:3796bde6ba8f | 38 | * v19 - TVOne mixing comms further optimised - August'12 |
tobyspark | 30:873979018850 | 39 | * v20 - Keying values and resolutions load from USB mass storage - September'12 |
tobyspark | 30:873979018850 | 40 | * v21 - Mixing behaviour upgrade: blend-additive as continuum, test cards on startup if no valid source - October'12 |
tobyspark | 35:d5d9f0838f99 | 41 | * v22 - EDID passthrough override and EDID upload from USB mass storage |
tobyspark | 36:8b5c75c8bc23 | 42 | * v23 - Set keying values from controller, requires a guided, step-through process for user |
tobyspark | 36:8b5c75c8bc23 | 43 | * vxx - TODO: Writes back to .ini on USB mass storage: keyer updates, comms, hdcp, edid internal/passthrough, ...? |
tobyspark | 8:d46cc49f0f37 | 44 | * vxx - TODO: EDID creation from resolution |
tobyspark | 8:d46cc49f0f37 | 45 | */ |
tobyspark | 8:d46cc49f0f37 | 46 | |
tobyspark | 0:87aab40d5806 | 47 | #include "mbed.h" |
tobyspark | 0:87aab40d5806 | 48 | |
tobyspark | 0:87aab40d5806 | 49 | #include "spk_tvone_mbed.h" |
tobyspark | 0:87aab40d5806 | 50 | #include "spk_utils.h" |
tobyspark | 0:87aab40d5806 | 51 | #include "spk_mRotaryEncoder.h" |
tobyspark | 0:87aab40d5806 | 52 | #include "spk_oled_ssd1305.h" |
tobyspark | 2:50043054e4f7 | 53 | #include "spk_oled_gfx.h" |
tobyspark | 11:0783cfbeb746 | 54 | #include "spk_settings.h" |
tobyspark | 1:f9fca21102e0 | 55 | #include "EthernetNetIf.h" |
tobyspark | 1:f9fca21102e0 | 56 | #include "mbedOSC.h" |
tobyspark | 3:033d2b7768f3 | 57 | #include "DmxArtNet.h" |
tobyspark | 5:f8b285ca41ba | 58 | #include "DMX.h" |
tobyspark | 17:fc68d40b8b1f | 59 | #include "filter.h" |
tobyspark | 0:87aab40d5806 | 60 | |
tobyspark | 36:8b5c75c8bc23 | 61 | #define kSPKDFSoftwareVersion "23" |
tobyspark | 13:3796bde6ba8f | 62 | |
tobyspark | 5:f8b285ca41ba | 63 | // MBED PINS |
tobyspark | 5:f8b285ca41ba | 64 | |
tobyspark | 5:f8b285ca41ba | 65 | #define kMBED_AIN_XFADE p20 |
tobyspark | 5:f8b285ca41ba | 66 | #define kMBED_AIN_FADEUP p19 |
tobyspark | 5:f8b285ca41ba | 67 | #define kMBED_DIN_TAP_L p24 |
tobyspark | 5:f8b285ca41ba | 68 | #define kMBED_DIN_TAP_R p23 |
tobyspark | 5:f8b285ca41ba | 69 | #define kMBED_ENC_SW p15 |
tobyspark | 5:f8b285ca41ba | 70 | #define kMBED_ENC_A p16 |
tobyspark | 5:f8b285ca41ba | 71 | #define kMBED_ENC_B p17 |
tobyspark | 5:f8b285ca41ba | 72 | |
tobyspark | 5:f8b285ca41ba | 73 | #define kMBED_RS232_TTLTX p13 |
tobyspark | 5:f8b285ca41ba | 74 | #define kMBED_RS232_TTLRX p14 |
tobyspark | 5:f8b285ca41ba | 75 | |
tobyspark | 5:f8b285ca41ba | 76 | #define kMBED_OLED_MOSI p5 |
tobyspark | 5:f8b285ca41ba | 77 | #define kMBED_OLED_SCK p7 |
tobyspark | 5:f8b285ca41ba | 78 | #define kMBED_OLED_CS p8 |
tobyspark | 5:f8b285ca41ba | 79 | #define kMBED_OLED_RES p9 |
tobyspark | 5:f8b285ca41ba | 80 | #define kMBED_OLED_DC p10 |
tobyspark | 5:f8b285ca41ba | 81 | |
tobyspark | 5:f8b285ca41ba | 82 | #define kMBED_DIN_ETHLO_DMXHI p30 |
tobyspark | 5:f8b285ca41ba | 83 | #define kMBED_DOUT_RS485_TXHI_RXLO p29 |
tobyspark | 5:f8b285ca41ba | 84 | #define kMBED_RS485_TTLTX p28 |
tobyspark | 5:f8b285ca41ba | 85 | #define kMBED_RS485_TTLRX p27 |
tobyspark | 5:f8b285ca41ba | 86 | |
tobyspark | 5:f8b285ca41ba | 87 | // DISPLAY |
tobyspark | 5:f8b285ca41ba | 88 | |
tobyspark | 1:f9fca21102e0 | 89 | #define kMenuLine1 3 |
tobyspark | 1:f9fca21102e0 | 90 | #define kMenuLine2 4 |
tobyspark | 1:f9fca21102e0 | 91 | #define kCommsStatusLine 6 |
tobyspark | 1:f9fca21102e0 | 92 | #define kTVOneStatusLine 7 |
tobyspark | 1:f9fca21102e0 | 93 | |
tobyspark | 5:f8b285ca41ba | 94 | // NETWORKING |
tobyspark | 5:f8b285ca41ba | 95 | |
tobyspark | 1:f9fca21102e0 | 96 | #define kOSCMbedPort 10000 |
tobyspark | 1:f9fca21102e0 | 97 | #define kOSCMbedIPAddress 10,0,0,2 |
tobyspark | 1:f9fca21102e0 | 98 | #define kOSCMbedSubnetMask 255,255,255,0 |
tobyspark | 1:f9fca21102e0 | 99 | #define kOSCMbedGateway 10,0,0,1 |
tobyspark | 1:f9fca21102e0 | 100 | #define kOSCMbedDNS 10,0,0,1 |
tobyspark | 0:87aab40d5806 | 101 | |
tobyspark | 3:033d2b7768f3 | 102 | #define kArtNetBindIPAddress 2,0,0,100 |
tobyspark | 3:033d2b7768f3 | 103 | #define kArtNetBroadcastAddress 2,255,255,255 |
tobyspark | 3:033d2b7768f3 | 104 | |
tobyspark | 5:f8b285ca41ba | 105 | #define kDMXInChannelXFade 0 |
tobyspark | 5:f8b285ca41ba | 106 | #define kDMXInChannelFadeUp 1 |
tobyspark | 5:f8b285ca41ba | 107 | #define kDMXOutChannelXFade 0 |
tobyspark | 5:f8b285ca41ba | 108 | #define kDMXOutChannelFadeUp 1 |
tobyspark | 5:f8b285ca41ba | 109 | |
tobyspark | 13:3796bde6ba8f | 110 | // 8.3 format filename only, no subdirs |
tobyspark | 13:3796bde6ba8f | 111 | #define kSPKDFSettingsFilename "SPKDF.ini" |
tobyspark | 11:0783cfbeb746 | 112 | |
tobyspark | 26:0299f8760715 | 113 | #define kStringBufferLength 30 |
tobyspark | 26:0299f8760715 | 114 | |
tobyspark | 0:87aab40d5806 | 115 | //// DEBUG |
tobyspark | 0:87aab40d5806 | 116 | |
tobyspark | 0:87aab40d5806 | 117 | // Comment out one or the other... |
tobyspark | 37:744bef2e8be8 | 118 | //Serial *debug = new Serial(USBTX, USBRX); // For debugging via USB serial |
tobyspark | 37:744bef2e8be8 | 119 | Serial *debug = NULL; // For release (no debugging) |
tobyspark | 0:87aab40d5806 | 120 | |
tobyspark | 15:4b394c64b461 | 121 | //// SOFT RESET |
tobyspark | 15:4b394c64b461 | 122 | |
tobyspark | 15:4b394c64b461 | 123 | extern "C" void mbed_reset(); |
tobyspark | 15:4b394c64b461 | 124 | |
tobyspark | 0:87aab40d5806 | 125 | //// mBED PIN ASSIGNMENTS |
tobyspark | 0:87aab40d5806 | 126 | |
tobyspark | 0:87aab40d5806 | 127 | // Inputs |
tobyspark | 5:f8b285ca41ba | 128 | AnalogIn xFadeAIN(kMBED_AIN_XFADE); |
tobyspark | 5:f8b285ca41ba | 129 | AnalogIn fadeUpAIN(kMBED_AIN_FADEUP); |
tobyspark | 5:f8b285ca41ba | 130 | DigitalIn tapLeftDIN(kMBED_DIN_TAP_L); |
tobyspark | 5:f8b285ca41ba | 131 | DigitalIn tapRightDIN(kMBED_DIN_TAP_R); |
tobyspark | 17:fc68d40b8b1f | 132 | medianFilter xFadeFilter(9); |
tobyspark | 17:fc68d40b8b1f | 133 | medianFilter fadeUpFilter(9); |
tobyspark | 0:87aab40d5806 | 134 | |
tobyspark | 5:f8b285ca41ba | 135 | SPKRotaryEncoder menuEnc(kMBED_ENC_A, kMBED_ENC_B, kMBED_ENC_SW); |
tobyspark | 5:f8b285ca41ba | 136 | |
tobyspark | 5:f8b285ca41ba | 137 | DigitalIn rj45ModeDIN(kMBED_DIN_ETHLO_DMXHI); |
tobyspark | 0:87aab40d5806 | 138 | |
tobyspark | 0:87aab40d5806 | 139 | // Outputs |
tobyspark | 0:87aab40d5806 | 140 | PwmOut fadeAPO(LED1); |
tobyspark | 0:87aab40d5806 | 141 | PwmOut fadeBPO(LED2); |
tobyspark | 0:87aab40d5806 | 142 | |
tobyspark | 5:f8b285ca41ba | 143 | DigitalOut dmxDirectionDOUT(kMBED_DOUT_RS485_TXHI_RXLO); |
tobyspark | 5:f8b285ca41ba | 144 | |
tobyspark | 0:87aab40d5806 | 145 | // SPKTVOne(PinName txPin, PinName rxPin, PinName signWritePin, PinName signErrorPin, Serial *debugSerial) |
tobyspark | 5:f8b285ca41ba | 146 | SPKTVOne tvOne(kMBED_RS232_TTLTX, kMBED_RS232_TTLRX, LED3, LED4, debug); |
tobyspark | 0:87aab40d5806 | 147 | |
tobyspark | 0:87aab40d5806 | 148 | // SPKDisplay(PinName mosi, PinName clk, PinName cs, PinName dc, PinName res, Serial *debugSerial = NULL); |
tobyspark | 5:f8b285ca41ba | 149 | SPKDisplay screen(kMBED_OLED_MOSI, kMBED_OLED_SCK, kMBED_OLED_CS, kMBED_OLED_DC, kMBED_OLED_RES, debug); |
tobyspark | 0:87aab40d5806 | 150 | |
tobyspark | 11:0783cfbeb746 | 151 | // Saved Settings |
tobyspark | 11:0783cfbeb746 | 152 | SPKSettings settings; |
tobyspark | 11:0783cfbeb746 | 153 | |
tobyspark | 0:87aab40d5806 | 154 | // Menu |
tobyspark | 0:87aab40d5806 | 155 | SPKMenu *selectedMenu; |
tobyspark | 23:909928cafb95 | 156 | SPKMenu mainMenu; |
tobyspark | 23:909928cafb95 | 157 | SPKMenu resolutionMenu; |
tobyspark | 12:c270870bdd23 | 158 | |
tobyspark | 24:49c6624119ae | 159 | SPKMenu mixModeMenu; |
tobyspark | 36:8b5c75c8bc23 | 160 | SPKMenu mixModeAdditiveMenu; |
tobyspark | 36:8b5c75c8bc23 | 161 | SPKMenu mixModeKeyerMenuUpdate; |
tobyspark | 36:8b5c75c8bc23 | 162 | SPKMenu mixModeKeyerMenuMinY; |
tobyspark | 36:8b5c75c8bc23 | 163 | SPKMenu mixModeKeyerMenuMaxY; |
tobyspark | 36:8b5c75c8bc23 | 164 | SPKMenu mixModeKeyerMenuMinU; |
tobyspark | 36:8b5c75c8bc23 | 165 | SPKMenu mixModeKeyerMenuMaxU; |
tobyspark | 36:8b5c75c8bc23 | 166 | SPKMenu mixModeKeyerMenuMinV; |
tobyspark | 36:8b5c75c8bc23 | 167 | SPKMenu mixModeKeyerMenuMaxV; |
tobyspark | 36:8b5c75c8bc23 | 168 | enum { mixBlend, mixAdditive, mixKey }; |
tobyspark | 36:8b5c75c8bc23 | 169 | int mixKeyStartIndex = 1; // need this hard coded as mixBlend and mixAdditive are now combined into the same menu item |
tobyspark | 30:873979018850 | 170 | int mixMode = mixBlend; // Start with safe mix mode, and test to get out of it. Safe mode will work with inputs missing and without hold frames. |
tobyspark | 29:95a7efe30527 | 171 | float fadeCurve = 0.0f; // 0 = "X", ie. as per blend, 1 = "/\", ie. as per additive <-- pictograms! |
tobyspark | 22:90054fe6d86c | 172 | |
tobyspark | 23:909928cafb95 | 173 | SPKMenu commsMenu; |
tobyspark | 5:f8b285ca41ba | 174 | enum { commsNone, commsOSC, commsArtNet, commsDMXIn, commsDMXOut}; |
tobyspark | 5:f8b285ca41ba | 175 | int commsMode = commsNone; |
tobyspark | 22:90054fe6d86c | 176 | |
tobyspark | 23:909928cafb95 | 177 | SPKMenu advancedMenu; |
tobyspark | 32:9f9eb3583bfa | 178 | enum { advancedHDCPOn, advancedHDCPOff, advancedEDIDPassthrough, advancedEDIDInternal, advancedTestSources, advancedConformProcessor, advancedLoadDefaults, advancedSetResolutions }; |
tobyspark | 1:f9fca21102e0 | 179 | |
tobyspark | 5:f8b285ca41ba | 180 | // RJ45 Comms |
tobyspark | 5:f8b285ca41ba | 181 | enum { rj45Ethernet = 0, rj45DMX = 1}; // These values from circuit |
tobyspark | 5:f8b285ca41ba | 182 | int rj45Mode = -1; |
tobyspark | 1:f9fca21102e0 | 183 | EthernetNetIf *ethernet = NULL; |
tobyspark | 1:f9fca21102e0 | 184 | OSCClass *osc = NULL; |
tobyspark | 33:e6672a9bd571 | 185 | OSCMessage sendMessage; |
tobyspark | 33:e6672a9bd571 | 186 | OSCMessage receiveMessage; |
tobyspark | 3:033d2b7768f3 | 187 | DmxArtNet *artNet = NULL; |
tobyspark | 5:f8b285ca41ba | 188 | DMX *dmx = NULL; |
tobyspark | 0:87aab40d5806 | 189 | |
tobyspark | 3:033d2b7768f3 | 190 | // Fade logic constants |
tobyspark | 0:87aab40d5806 | 191 | const float xFadeTolerance = 0.05; |
tobyspark | 0:87aab40d5806 | 192 | const float fadeUpTolerance = 0.05; |
tobyspark | 0:87aab40d5806 | 193 | |
tobyspark | 0:87aab40d5806 | 194 | // A&B Fade as resolved percent |
tobyspark | 0:87aab40d5806 | 195 | int fadeAPercent = 0; |
tobyspark | 0:87aab40d5806 | 196 | int fadeBPercent = 0; |
tobyspark | 17:fc68d40b8b1f | 197 | int oldFadeAPercent = 0; |
tobyspark | 17:fc68d40b8b1f | 198 | int oldFadeBPercent = 0; |
tobyspark | 0:87aab40d5806 | 199 | |
tobyspark | 0:87aab40d5806 | 200 | // Tap button states |
tobyspark | 5:f8b285ca41ba | 201 | bool tapLeftWasFirstPressed = false; |
tobyspark | 0:87aab40d5806 | 202 | |
tobyspark | 0:87aab40d5806 | 203 | // Key mode parameters |
tobyspark | 0:87aab40d5806 | 204 | int keyerParamsSet = -1; // last keyParams index uploaded to unit |
tobyspark | 0:87aab40d5806 | 205 | |
tobyspark | 30:873979018850 | 206 | // TVOne input sources stable flag |
tobyspark | 34:69dfe64e7e6b | 207 | bool tvOneRGB1Stable = false; |
tobyspark | 34:69dfe64e7e6b | 208 | bool tvOneRGB2Stable = false; |
tobyspark | 30:873979018850 | 209 | |
tobyspark | 31:01845a2347ff | 210 | // TVOne behaviour flags |
tobyspark | 31:01845a2347ff | 211 | bool tvOneHDCPOn = false; |
tobyspark | 34:69dfe64e7e6b | 212 | bool tvOneEDIDPassthrough = false; |
tobyspark | 31:01845a2347ff | 213 | const int32_t EDIDPassthroughSlot = 7; |
tobyspark | 31:01845a2347ff | 214 | |
tobyspark | 34:69dfe64e7e6b | 215 | |
tobyspark | 33:e6672a9bd571 | 216 | void processOSCIn(float &xFade, float &fadeUp) { |
tobyspark | 25:3b519ef70341 | 217 | string statusMessage; |
tobyspark | 3:033d2b7768f3 | 218 | |
tobyspark | 33:e6672a9bd571 | 219 | if (!strcmp( receiveMessage.getTopAddress() , "dvimxr" )) |
tobyspark | 3:033d2b7768f3 | 220 | { |
tobyspark | 25:3b519ef70341 | 221 | statusMessage = "OSC: /dvimxr"; |
tobyspark | 33:e6672a9bd571 | 222 | if (!strcmp( receiveMessage.getSubAddress() , "xFade" )) |
tobyspark | 25:3b519ef70341 | 223 | { |
tobyspark | 33:e6672a9bd571 | 224 | if (receiveMessage.getArgNum() == 1) |
tobyspark | 33:e6672a9bd571 | 225 | if (receiveMessage.getTypeTag(0) == 'f') |
tobyspark | 25:3b519ef70341 | 226 | { |
tobyspark | 33:e6672a9bd571 | 227 | xFade = receiveMessage.getArgFloat(0); |
tobyspark | 25:3b519ef70341 | 228 | char buffer[15]; |
tobyspark | 26:0299f8760715 | 229 | snprintf(buffer, kStringBufferLength, "/xFade %1.2f", xFade); |
tobyspark | 25:3b519ef70341 | 230 | statusMessage += buffer; |
tobyspark | 25:3b519ef70341 | 231 | } |
tobyspark | 25:3b519ef70341 | 232 | } |
tobyspark | 33:e6672a9bd571 | 233 | else if (!strcmp( receiveMessage.getSubAddress() , "fadeUp" )) |
tobyspark | 25:3b519ef70341 | 234 | { |
tobyspark | 33:e6672a9bd571 | 235 | if (receiveMessage.getArgNum() == 1) |
tobyspark | 33:e6672a9bd571 | 236 | if (receiveMessage.getTypeTag(0) == 'f') |
tobyspark | 3:033d2b7768f3 | 237 | { |
tobyspark | 33:e6672a9bd571 | 238 | fadeUp = receiveMessage.getArgFloat(0); |
tobyspark | 25:3b519ef70341 | 239 | char buffer[15]; |
tobyspark | 26:0299f8760715 | 240 | snprintf(buffer, kStringBufferLength, "/fadeUp %1.2f", fadeUp); |
tobyspark | 25:3b519ef70341 | 241 | statusMessage += buffer; |
tobyspark | 3:033d2b7768f3 | 242 | } |
tobyspark | 25:3b519ef70341 | 243 | } |
tobyspark | 25:3b519ef70341 | 244 | else |
tobyspark | 25:3b519ef70341 | 245 | { |
tobyspark | 33:e6672a9bd571 | 246 | statusMessage += receiveMessage.getSubAddress(); |
tobyspark | 25:3b519ef70341 | 247 | statusMessage += " - Ignoring"; |
tobyspark | 25:3b519ef70341 | 248 | } |
tobyspark | 3:033d2b7768f3 | 249 | } |
tobyspark | 3:033d2b7768f3 | 250 | else |
tobyspark | 3:033d2b7768f3 | 251 | { |
tobyspark | 25:3b519ef70341 | 252 | statusMessage = "OSC: "; |
tobyspark | 33:e6672a9bd571 | 253 | statusMessage += receiveMessage.getTopAddress(); |
tobyspark | 25:3b519ef70341 | 254 | statusMessage += " - Ignoring"; |
tobyspark | 3:033d2b7768f3 | 255 | } |
tobyspark | 3:033d2b7768f3 | 256 | |
tobyspark | 3:033d2b7768f3 | 257 | screen.clearBufferRow(kCommsStatusLine); |
tobyspark | 25:3b519ef70341 | 258 | screen.textToBuffer(statusMessage, kCommsStatusLine); |
tobyspark | 33:e6672a9bd571 | 259 | |
tobyspark | 25:3b519ef70341 | 260 | if (debug) debug->printf("%s \r\n", statusMessage.c_str()); |
tobyspark | 3:033d2b7768f3 | 261 | |
tobyspark | 3:033d2b7768f3 | 262 | } |
tobyspark | 3:033d2b7768f3 | 263 | |
tobyspark | 33:e6672a9bd571 | 264 | void processOSCOut(float &xFade, float &fadeUp) |
tobyspark | 33:e6672a9bd571 | 265 | { |
tobyspark | 33:e6672a9bd571 | 266 | char statusMessageBuffer[kStringBufferLength]; |
tobyspark | 33:e6672a9bd571 | 267 | |
tobyspark | 33:e6672a9bd571 | 268 | sendMessage.setAddress("dvimxr", "xFadeFadeUp"); |
tobyspark | 33:e6672a9bd571 | 269 | sendMessage.setArgs("ff", &xFade, &fadeUp); |
tobyspark | 33:e6672a9bd571 | 270 | osc->sendOsc(&sendMessage); |
tobyspark | 33:e6672a9bd571 | 271 | |
tobyspark | 33:e6672a9bd571 | 272 | screen.clearBufferRow(kCommsStatusLine); |
tobyspark | 33:e6672a9bd571 | 273 | snprintf(statusMessageBuffer, kStringBufferLength, "OSC Out: xF %.2f fUp %.2f", xFade, fadeUp); |
tobyspark | 33:e6672a9bd571 | 274 | screen.textToBuffer(statusMessageBuffer, kCommsStatusLine); |
tobyspark | 33:e6672a9bd571 | 275 | |
tobyspark | 33:e6672a9bd571 | 276 | if (debug) debug->printf(statusMessageBuffer); |
tobyspark | 33:e6672a9bd571 | 277 | } |
tobyspark | 33:e6672a9bd571 | 278 | |
tobyspark | 33:e6672a9bd571 | 279 | void processArtNetIn(float &xFade, float &fadeUp) |
tobyspark | 8:d46cc49f0f37 | 280 | { |
tobyspark | 3:033d2b7768f3 | 281 | screen.clearBufferRow(kCommsStatusLine); |
tobyspark | 3:033d2b7768f3 | 282 | screen.textToBuffer("ArtNet activity", kCommsStatusLine); |
tobyspark | 33:e6672a9bd571 | 283 | |
tobyspark | 3:033d2b7768f3 | 284 | if (debug) debug->printf("ArtNet activity"); |
tobyspark | 3:033d2b7768f3 | 285 | } |
tobyspark | 0:87aab40d5806 | 286 | |
tobyspark | 33:e6672a9bd571 | 287 | void processArtNetOut(float &xFade, float &fadeUp) |
tobyspark | 33:e6672a9bd571 | 288 | { |
tobyspark | 33:e6672a9bd571 | 289 | char statusMessageBuffer[kStringBufferLength]; |
tobyspark | 33:e6672a9bd571 | 290 | |
tobyspark | 33:e6672a9bd571 | 291 | int xFadeDMX = xFade*255; |
tobyspark | 33:e6672a9bd571 | 292 | int fadeUpDMX = fadeUp*255; |
tobyspark | 33:e6672a9bd571 | 293 | |
tobyspark | 33:e6672a9bd571 | 294 | // Universe 0, Channel 0 = xFade, Channel 1 = fadeUp |
tobyspark | 33:e6672a9bd571 | 295 | char dmxData[2] = {xFadeDMX, fadeUpDMX}; |
tobyspark | 33:e6672a9bd571 | 296 | artNet->Send_ArtDmx(0, 0, dmxData, 2); |
tobyspark | 33:e6672a9bd571 | 297 | |
tobyspark | 33:e6672a9bd571 | 298 | screen.clearBufferRow(kCommsStatusLine); |
tobyspark | 33:e6672a9bd571 | 299 | snprintf(statusMessageBuffer, kStringBufferLength, "A'Net Out: xF%3i fUp %3i", xFadeDMX, fadeUpDMX); |
tobyspark | 33:e6672a9bd571 | 300 | screen.textToBuffer(statusMessageBuffer, kCommsStatusLine); |
tobyspark | 33:e6672a9bd571 | 301 | |
tobyspark | 33:e6672a9bd571 | 302 | if (debug) debug->printf(statusMessageBuffer); |
tobyspark | 33:e6672a9bd571 | 303 | } |
tobyspark | 33:e6672a9bd571 | 304 | |
tobyspark | 8:d46cc49f0f37 | 305 | void processDMXIn(float &xFade, float &fadeUp) |
tobyspark | 8:d46cc49f0f37 | 306 | { |
tobyspark | 26:0299f8760715 | 307 | char statusMessageBuffer[kStringBufferLength]; |
tobyspark | 5:f8b285ca41ba | 308 | |
tobyspark | 5:f8b285ca41ba | 309 | int xFadeDMX = dmx->get(kDMXInChannelXFade); |
tobyspark | 7:e6717468c18d | 310 | int fadeUpDMX = dmx->get(kDMXInChannelFadeUp); |
tobyspark | 5:f8b285ca41ba | 311 | |
tobyspark | 5:f8b285ca41ba | 312 | xFade = (float)xFadeDMX/255; |
tobyspark | 5:f8b285ca41ba | 313 | fadeUp = (float)fadeUpDMX/255; |
tobyspark | 5:f8b285ca41ba | 314 | |
tobyspark | 5:f8b285ca41ba | 315 | screen.clearBufferRow(kCommsStatusLine); |
tobyspark | 26:0299f8760715 | 316 | snprintf(statusMessageBuffer, kStringBufferLength, "DMX In: xF %3i fUp %3i", xFadeDMX, fadeUpDMX); |
tobyspark | 25:3b519ef70341 | 317 | screen.textToBuffer(statusMessageBuffer, kCommsStatusLine); |
tobyspark | 33:e6672a9bd571 | 318 | |
tobyspark | 25:3b519ef70341 | 319 | if (debug) debug->printf(statusMessageBuffer); |
tobyspark | 5:f8b285ca41ba | 320 | } |
tobyspark | 5:f8b285ca41ba | 321 | |
tobyspark | 8:d46cc49f0f37 | 322 | void processDMXOut(float &xFade, float &fadeUp) |
tobyspark | 8:d46cc49f0f37 | 323 | { |
tobyspark | 26:0299f8760715 | 324 | char statusMessageBuffer[kStringBufferLength]; |
tobyspark | 5:f8b285ca41ba | 325 | |
tobyspark | 5:f8b285ca41ba | 326 | int xFadeDMX = xFade*255; |
tobyspark | 5:f8b285ca41ba | 327 | int fadeUpDMX = fadeUp*255; |
tobyspark | 5:f8b285ca41ba | 328 | |
tobyspark | 5:f8b285ca41ba | 329 | dmx->put(kDMXOutChannelXFade, xFadeDMX); |
tobyspark | 5:f8b285ca41ba | 330 | dmx->put(kDMXOutChannelFadeUp, fadeUpDMX); |
tobyspark | 5:f8b285ca41ba | 331 | |
tobyspark | 5:f8b285ca41ba | 332 | screen.clearBufferRow(kCommsStatusLine); |
tobyspark | 26:0299f8760715 | 333 | snprintf(statusMessageBuffer, kStringBufferLength, "DMX Out: xF %3i fUp %3i", xFadeDMX, fadeUpDMX); |
tobyspark | 25:3b519ef70341 | 334 | screen.textToBuffer(statusMessageBuffer, kCommsStatusLine); |
tobyspark | 33:e6672a9bd571 | 335 | |
tobyspark | 25:3b519ef70341 | 336 | if (debug) debug->printf(statusMessageBuffer); |
tobyspark | 5:f8b285ca41ba | 337 | } |
tobyspark | 0:87aab40d5806 | 338 | |
tobyspark | 8:d46cc49f0f37 | 339 | inline float fadeCalc (const float AIN, const float tolerance) |
tobyspark | 8:d46cc49f0f37 | 340 | { |
tobyspark | 0:87aab40d5806 | 341 | float pos ; |
tobyspark | 0:87aab40d5806 | 342 | if (AIN < tolerance) pos = 0; |
tobyspark | 0:87aab40d5806 | 343 | else if (AIN > 1.0 - tolerance) pos = 1; |
tobyspark | 0:87aab40d5806 | 344 | else pos = (AIN - tolerance) / (1 - 2*tolerance); |
tobyspark | 0:87aab40d5806 | 345 | if (debug && false) debug->printf("fadeCalc in: %f out: %f \r\n", AIN, pos); |
tobyspark | 0:87aab40d5806 | 346 | return pos; |
tobyspark | 0:87aab40d5806 | 347 | } |
tobyspark | 0:87aab40d5806 | 348 | |
tobyspark | 34:69dfe64e7e6b | 349 | bool handleTVOneSources() |
tobyspark | 30:873979018850 | 350 | { |
tobyspark | 30:873979018850 | 351 | bool ok = true; |
tobyspark | 30:873979018850 | 352 | |
tobyspark | 30:873979018850 | 353 | int32_t payload = 0; |
tobyspark | 30:873979018850 | 354 | |
tobyspark | 30:873979018850 | 355 | ok = ok && tvOne.readCommand(kTV1SourceRGB1, kTV1WindowIDA, kTV1FunctionAdjustSourceSourceStable, payload); |
tobyspark | 34:69dfe64e7e6b | 356 | bool RGB1 = (payload == 1); |
tobyspark | 30:873979018850 | 357 | |
tobyspark | 30:873979018850 | 358 | ok = ok && tvOne.readCommand(kTV1SourceRGB2, kTV1WindowIDA, kTV1FunctionAdjustSourceSourceStable, payload); |
tobyspark | 30:873979018850 | 359 | bool RGB2 = (payload == 1); |
tobyspark | 30:873979018850 | 360 | |
tobyspark | 34:69dfe64e7e6b | 361 | ok = ok && tvOne.readCommand(0, kTV1WindowIDA, kTV1FunctionAdjustWindowsWindowSource, payload); |
tobyspark | 34:69dfe64e7e6b | 362 | int sourceA = payload; |
tobyspark | 34:69dfe64e7e6b | 363 | |
tobyspark | 34:69dfe64e7e6b | 364 | ok = ok && tvOne.readCommand(0, kTV1WindowIDB, kTV1FunctionAdjustWindowsWindowSource, payload); |
tobyspark | 34:69dfe64e7e6b | 365 | int sourceB = payload; |
tobyspark | 34:69dfe64e7e6b | 366 | |
tobyspark | 34:69dfe64e7e6b | 367 | if (debug) debug->printf("HandleTVOneSources: RGB1: %i, RGB2: %i, sourceA: %#x, sourceB: %#i \r\n", RGB1, RGB2, sourceA, sourceB); |
tobyspark | 34:69dfe64e7e6b | 368 | |
tobyspark | 30:873979018850 | 369 | string tvOneDetectString; |
tobyspark | 30:873979018850 | 370 | if (!ok) |
tobyspark | 30:873979018850 | 371 | { |
tobyspark | 30:873979018850 | 372 | tvOneDetectString = "TVOne: link failed"; |
tobyspark | 30:873979018850 | 373 | } |
tobyspark | 30:873979018850 | 374 | else if (!RGB1 || !RGB2) |
tobyspark | 30:873979018850 | 375 | { |
tobyspark | 30:873979018850 | 376 | if (!RGB1 && !RGB2) tvOneDetectString = "TVOne: no sources"; |
tobyspark | 30:873979018850 | 377 | else if (!RGB1) tvOneDetectString = "TVOne: no right source"; |
tobyspark | 30:873979018850 | 378 | else if (!RGB2) tvOneDetectString = "TVOne: no left source"; |
tobyspark | 30:873979018850 | 379 | } |
tobyspark | 30:873979018850 | 380 | else |
tobyspark | 30:873979018850 | 381 | { |
tobyspark | 30:873979018850 | 382 | tvOneDetectString = "TVOne: OK"; |
tobyspark | 30:873979018850 | 383 | } |
tobyspark | 30:873979018850 | 384 | |
tobyspark | 34:69dfe64e7e6b | 385 | screen.clearBufferRow(kTVOneStatusLine); |
tobyspark | 34:69dfe64e7e6b | 386 | screen.textToBuffer(tvOneDetectString, kTVOneStatusLine); |
tobyspark | 34:69dfe64e7e6b | 387 | |
tobyspark | 34:69dfe64e7e6b | 388 | // Assign appropriate source depending on whether DVI input is good |
tobyspark | 34:69dfe64e7e6b | 389 | // If that assign command completes ok, and the DVI input is good, finally flag the unit has had a live source |
tobyspark | 34:69dfe64e7e6b | 390 | // Note any further losses on this input will be handled by the unit holding the last frame, so we don't need to switch back to SIS. |
tobyspark | 34:69dfe64e7e6b | 391 | if (ok && !tvOneRGB1Stable) |
tobyspark | 30:873979018850 | 392 | { |
tobyspark | 34:69dfe64e7e6b | 393 | if (RGB1 && (sourceB != kTV1SourceRGB1)) ok = ok && tvOne.command(0, kTV1WindowIDB, kTV1FunctionAdjustWindowsWindowSource, kTV1SourceRGB1); |
tobyspark | 34:69dfe64e7e6b | 394 | if (!RGB1 && (sourceB != kTV1SourceSIS2)) ok = ok && tvOne.command(0, kTV1WindowIDB, kTV1FunctionAdjustWindowsWindowSource, kTV1SourceSIS2); // Wierd: Can't set to SIS1 sometimes. |
tobyspark | 34:69dfe64e7e6b | 395 | if (ok && RGB1) tvOneRGB1Stable = true; |
tobyspark | 30:873979018850 | 396 | } |
tobyspark | 34:69dfe64e7e6b | 397 | if (ok && !tvOneRGB2Stable) |
tobyspark | 34:69dfe64e7e6b | 398 | { |
tobyspark | 34:69dfe64e7e6b | 399 | if (RGB2 && (sourceA != kTV1SourceRGB2)) ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustWindowsWindowSource, kTV1SourceRGB2); |
tobyspark | 34:69dfe64e7e6b | 400 | if (!RGB2 && (sourceA != kTV1SourceSIS2)) ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustWindowsWindowSource, kTV1SourceSIS2); |
tobyspark | 34:69dfe64e7e6b | 401 | if (ok && RGB2) tvOneRGB2Stable = true; |
tobyspark | 34:69dfe64e7e6b | 402 | } |
tobyspark | 30:873979018850 | 403 | |
tobyspark | 30:873979018850 | 404 | return ok; |
tobyspark | 30:873979018850 | 405 | } |
tobyspark | 30:873979018850 | 406 | |
tobyspark | 8:d46cc49f0f37 | 407 | bool setKeyParamsTo(int index) |
tobyspark | 8:d46cc49f0f37 | 408 | { |
tobyspark | 0:87aab40d5806 | 409 | // Only spend the time uploading six parameters if we need to |
tobyspark | 0:87aab40d5806 | 410 | // Might want to bounds check here |
tobyspark | 0:87aab40d5806 | 411 | |
tobyspark | 9:f83eadd8917a | 412 | bool ok; |
tobyspark | 0:87aab40d5806 | 413 | |
tobyspark | 0:87aab40d5806 | 414 | if (index != keyerParamsSet) |
tobyspark | 0:87aab40d5806 | 415 | { |
tobyspark | 31:01845a2347ff | 416 | ok = tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerMinY, settings.keyerParamSet(index)[SPKSettings::minY]); |
tobyspark | 31:01845a2347ff | 417 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerMaxY, settings.keyerParamSet(index)[SPKSettings::maxY]); |
tobyspark | 31:01845a2347ff | 418 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerMinU, settings.keyerParamSet(index)[SPKSettings::minU]); |
tobyspark | 31:01845a2347ff | 419 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerMaxU, settings.keyerParamSet(index)[SPKSettings::maxU]); |
tobyspark | 31:01845a2347ff | 420 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerMinV, settings.keyerParamSet(index)[SPKSettings::minV]); |
tobyspark | 31:01845a2347ff | 421 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerMaxV, settings.keyerParamSet(index)[SPKSettings::maxV]); |
tobyspark | 0:87aab40d5806 | 422 | |
tobyspark | 0:87aab40d5806 | 423 | keyerParamsSet = index; |
tobyspark | 9:f83eadd8917a | 424 | } |
tobyspark | 9:f83eadd8917a | 425 | else |
tobyspark | 9:f83eadd8917a | 426 | { |
tobyspark | 9:f83eadd8917a | 427 | ok = true; |
tobyspark | 9:f83eadd8917a | 428 | } |
tobyspark | 0:87aab40d5806 | 429 | |
tobyspark | 0:87aab40d5806 | 430 | return ok; |
tobyspark | 0:87aab40d5806 | 431 | } |
tobyspark | 0:87aab40d5806 | 432 | |
tobyspark | 24:49c6624119ae | 433 | void actionMixMode() |
tobyspark | 24:49c6624119ae | 434 | { |
tobyspark | 31:01845a2347ff | 435 | if (debug) debug->printf("Changing mix mode \r\n"); |
tobyspark | 31:01845a2347ff | 436 | |
tobyspark | 24:49c6624119ae | 437 | bool ok = true; |
tobyspark | 25:3b519ef70341 | 438 | string sentOK; |
tobyspark | 26:0299f8760715 | 439 | char sentMSGBuffer[kStringBufferLength]; |
tobyspark | 24:49c6624119ae | 440 | |
tobyspark | 24:49c6624119ae | 441 | // Set Keyer |
tobyspark | 36:8b5c75c8bc23 | 442 | if (mixMode < mixKeyStartIndex) |
tobyspark | 24:49c6624119ae | 443 | { |
tobyspark | 31:01845a2347ff | 444 | // Set Keyer Off. Quicker to set and fail than to test for on and then turn off |
tobyspark | 35:d5d9f0838f99 | 445 | tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerEnable, false); |
tobyspark | 31:01845a2347ff | 446 | |
tobyspark | 31:01845a2347ff | 447 | if (mixMode == mixBlend) |
tobyspark | 24:49c6624119ae | 448 | { |
tobyspark | 31:01845a2347ff | 449 | // Turn off Additive Mixing on output |
tobyspark | 31:01845a2347ff | 450 | ok = tvOne.command(0, kTV1WindowIDA, 0x298, 0); |
tobyspark | 31:01845a2347ff | 451 | snprintf(sentMSGBuffer, kStringBufferLength, "Blend"); |
tobyspark | 24:49c6624119ae | 452 | } |
tobyspark | 31:01845a2347ff | 453 | if (mixMode == mixAdditive) |
tobyspark | 31:01845a2347ff | 454 | { |
tobyspark | 31:01845a2347ff | 455 | // First set B to what you'd expect for additive; it may be left at 100 if optimised blend mixing was previous mixmode. |
tobyspark | 31:01845a2347ff | 456 | ok = tvOne.command(0, kTV1WindowIDB, kTV1FunctionAdjustWindowsMaxFadeLevel, fadeBPercent); |
tobyspark | 31:01845a2347ff | 457 | // Then turn on Additive Mixing |
tobyspark | 31:01845a2347ff | 458 | ok = ok && tvOne.command(0, kTV1WindowIDA, 0x298, 1); |
tobyspark | 31:01845a2347ff | 459 | snprintf(sentMSGBuffer, kStringBufferLength, "Additive"); |
tobyspark | 31:01845a2347ff | 460 | } |
tobyspark | 24:49c6624119ae | 461 | } |
tobyspark | 24:49c6624119ae | 462 | else |
tobyspark | 24:49c6624119ae | 463 | { |
tobyspark | 36:8b5c75c8bc23 | 464 | int index = mixMode - mixKeyStartIndex; |
tobyspark | 25:3b519ef70341 | 465 | |
tobyspark | 24:49c6624119ae | 466 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerEnable, true); |
tobyspark | 24:49c6624119ae | 467 | ok = ok && setKeyParamsTo(index); |
tobyspark | 25:3b519ef70341 | 468 | |
tobyspark | 26:0299f8760715 | 469 | snprintf(sentMSGBuffer, kStringBufferLength, "Keyer On with %i", index); |
tobyspark | 24:49c6624119ae | 470 | } |
tobyspark | 24:49c6624119ae | 471 | |
tobyspark | 24:49c6624119ae | 472 | if (ok) sentOK = "Sent:"; |
tobyspark | 24:49c6624119ae | 473 | else sentOK = "Send Error:"; |
tobyspark | 24:49c6624119ae | 474 | |
tobyspark | 24:49c6624119ae | 475 | screen.clearBufferRow(kTVOneStatusLine); |
tobyspark | 25:3b519ef70341 | 476 | screen.textToBuffer(sentOK + sentMSGBuffer, kTVOneStatusLine); |
tobyspark | 24:49c6624119ae | 477 | } |
tobyspark | 24:49c6624119ae | 478 | |
tobyspark | 24:49c6624119ae | 479 | |
tobyspark | 17:fc68d40b8b1f | 480 | bool conformProcessor() |
tobyspark | 17:fc68d40b8b1f | 481 | { |
tobyspark | 17:fc68d40b8b1f | 482 | bool ok = true; |
tobyspark | 17:fc68d40b8b1f | 483 | |
tobyspark | 17:fc68d40b8b1f | 484 | int32_t on = 1; |
tobyspark | 17:fc68d40b8b1f | 485 | int32_t off = 0; |
tobyspark | 20:8b92d7922c48 | 486 | |
tobyspark | 20:8b92d7922c48 | 487 | // Independent output |
tobyspark | 30:873979018850 | 488 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionMode, 2); |
tobyspark | 20:8b92d7922c48 | 489 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustOutputsOutputEnable, on); |
tobyspark | 20:8b92d7922c48 | 490 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustOutputsLockMethod, off); |
tobyspark | 17:fc68d40b8b1f | 491 | |
tobyspark | 17:fc68d40b8b1f | 492 | // Make sure our windows exist |
tobyspark | 17:fc68d40b8b1f | 493 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustWindowsEnable, on); |
tobyspark | 17:fc68d40b8b1f | 494 | ok = ok && tvOne.command(0, kTV1WindowIDB, kTV1FunctionAdjustWindowsEnable, on); |
tobyspark | 18:ebe5da639a6a | 495 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustWindowsLayerPriority, 0); |
tobyspark | 18:ebe5da639a6a | 496 | ok = ok && tvOne.command(0, kTV1WindowIDB, kTV1FunctionAdjustWindowsLayerPriority, 1); |
tobyspark | 17:fc68d40b8b1f | 497 | |
tobyspark | 17:fc68d40b8b1f | 498 | // Assign inputs to windows, so that left on the crossfader is left on the processor viewed from front |
tobyspark | 17:fc68d40b8b1f | 499 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustWindowsWindowSource, kTV1SourceRGB2); |
tobyspark | 17:fc68d40b8b1f | 500 | ok = ok && tvOne.command(0, kTV1WindowIDB, kTV1FunctionAdjustWindowsWindowSource, kTV1SourceRGB1); |
tobyspark | 17:fc68d40b8b1f | 501 | |
tobyspark | 17:fc68d40b8b1f | 502 | // Set scaling to fit source within output, maintaining aspect ratio |
tobyspark | 17:fc68d40b8b1f | 503 | ok = ok && tvOne.command(kTV1SourceRGB1, kTV1WindowIDA, kTV1FunctionAdjustWindowsZoomLevel, 100); |
tobyspark | 17:fc68d40b8b1f | 504 | ok = ok && tvOne.command(kTV1SourceRGB1, kTV1WindowIDB, kTV1FunctionAdjustWindowsZoomLevel, 100); |
tobyspark | 17:fc68d40b8b1f | 505 | ok = ok && tvOne.command(kTV1SourceRGB1, kTV1WindowIDA, kTV1FunctionAdjustWindowsShrinkEnable, off); |
tobyspark | 17:fc68d40b8b1f | 506 | ok = ok && tvOne.command(kTV1SourceRGB1, kTV1WindowIDB, kTV1FunctionAdjustWindowsShrinkEnable, off); |
tobyspark | 17:fc68d40b8b1f | 507 | int32_t fit = 1; |
tobyspark | 17:fc68d40b8b1f | 508 | ok = ok && tvOne.command(kTV1SourceRGB1, kTV1WindowIDA, kTV1FunctionAdjustSourceAspectCorrect, fit); |
tobyspark | 17:fc68d40b8b1f | 509 | ok = ok && tvOne.command(kTV1SourceRGB2, kTV1WindowIDA, kTV1FunctionAdjustSourceAspectCorrect, fit); |
tobyspark | 17:fc68d40b8b1f | 510 | |
tobyspark | 17:fc68d40b8b1f | 511 | // On source loss, hold on the last frame received. |
tobyspark | 17:fc68d40b8b1f | 512 | int32_t freeze = 1; |
tobyspark | 17:fc68d40b8b1f | 513 | ok = ok && tvOne.command(kTV1SourceRGB1, kTV1WindowIDA, kTV1FunctionAdjustSourceOnSourceLoss, freeze); |
tobyspark | 17:fc68d40b8b1f | 514 | ok = ok && tvOne.command(kTV1SourceRGB2, kTV1WindowIDA, kTV1FunctionAdjustSourceOnSourceLoss, freeze); |
tobyspark | 17:fc68d40b8b1f | 515 | |
tobyspark | 30:873979018850 | 516 | // Set resolution and fade levels for maximum chance of being seen |
tobyspark | 31:01845a2347ff | 517 | int32_t slot = tvOneEDIDPassthrough ? EDIDPassthroughSlot : 5; |
tobyspark | 30:873979018850 | 518 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustOutputsOutputResolution, kTV1ResolutionVGA); |
tobyspark | 31:01845a2347ff | 519 | ok = ok && tvOne.command(kTV1SourceRGB1, kTV1WindowIDA, kTV1FunctionAdjustSourceEDID, slot); |
tobyspark | 31:01845a2347ff | 520 | ok = ok && tvOne.command(kTV1SourceRGB2, kTV1WindowIDA, kTV1FunctionAdjustSourceEDID, slot); |
tobyspark | 30:873979018850 | 521 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustWindowsMaxFadeLevel, 100); |
tobyspark | 30:873979018850 | 522 | ok = ok && tvOne.command(0, kTV1WindowIDB, kTV1FunctionAdjustWindowsMaxFadeLevel, 100); |
tobyspark | 30:873979018850 | 523 | |
tobyspark | 34:69dfe64e7e6b | 524 | // Upload Matrox EDID to mem4 (ie. index 3). Use this EDID slot when setting Matrox resolutions. |
tobyspark | 34:69dfe64e7e6b | 525 | char edidData[256]; |
tobyspark | 34:69dfe64e7e6b | 526 | int i; |
tobyspark | 34:69dfe64e7e6b | 527 | { |
tobyspark | 34:69dfe64e7e6b | 528 | LocalFileSystem local("local"); |
tobyspark | 35:d5d9f0838f99 | 529 | FILE *file = fopen("/local/matroxe.did", "r"); // 8.3, avoid .bin as mbed executable extension |
tobyspark | 35:d5d9f0838f99 | 530 | if (file) |
tobyspark | 34:69dfe64e7e6b | 531 | { |
tobyspark | 35:d5d9f0838f99 | 532 | for ( i=0; i<256; i++) |
tobyspark | 35:d5d9f0838f99 | 533 | { |
tobyspark | 35:d5d9f0838f99 | 534 | int edidByte = fgetc(file); |
tobyspark | 35:d5d9f0838f99 | 535 | if (edidByte == EOF) break; |
tobyspark | 35:d5d9f0838f99 | 536 | else edidData[i] = edidByte; |
tobyspark | 35:d5d9f0838f99 | 537 | } |
tobyspark | 35:d5d9f0838f99 | 538 | fclose(file); |
tobyspark | 35:d5d9f0838f99 | 539 | |
tobyspark | 35:d5d9f0838f99 | 540 | ok = ok && tvOne.uploadEDID(edidData, i, 3); |
tobyspark | 34:69dfe64e7e6b | 541 | } |
tobyspark | 35:d5d9f0838f99 | 542 | else |
tobyspark | 35:d5d9f0838f99 | 543 | { |
tobyspark | 35:d5d9f0838f99 | 544 | if (debug) debug->printf("Could not open Matrox EDID file 'matroxe.did'"); |
tobyspark | 35:d5d9f0838f99 | 545 | } |
tobyspark | 34:69dfe64e7e6b | 546 | } |
tobyspark | 35:d5d9f0838f99 | 547 | |
tobyspark | 35:d5d9f0838f99 | 548 | // Save current state in preset one |
tobyspark | 35:d5d9f0838f99 | 549 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionPreset, 0); // Set Preset 1 |
tobyspark | 35:d5d9f0838f99 | 550 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionPresetStore, 1); // Store |
tobyspark | 34:69dfe64e7e6b | 551 | |
tobyspark | 30:873979018850 | 552 | // Save current state for power on |
tobyspark | 30:873979018850 | 553 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionPowerOnPresetStore, 1); |
tobyspark | 17:fc68d40b8b1f | 554 | |
tobyspark | 17:fc68d40b8b1f | 555 | return ok; |
tobyspark | 17:fc68d40b8b1f | 556 | } |
tobyspark | 17:fc68d40b8b1f | 557 | |
tobyspark | 27:27851d3d2bba | 558 | void setResolutionMenuItems() |
tobyspark | 27:27851d3d2bba | 559 | { |
tobyspark | 27:27851d3d2bba | 560 | resolutionMenu.clearMenuItems(); |
tobyspark | 27:27851d3d2bba | 561 | for (int i=0; i < settings.resolutionsCount(); i++) |
tobyspark | 27:27851d3d2bba | 562 | { |
tobyspark | 27:27851d3d2bba | 563 | resolutionMenu.addMenuItem(SPKMenuItem(settings.resolutionName(i), settings.resolutionIndex(i), settings.resolutionEDIDIndex(i))); |
tobyspark | 27:27851d3d2bba | 564 | } |
tobyspark | 27:27851d3d2bba | 565 | resolutionMenu.addMenuItem(SPKMenuItem("Back to Main Menu", &mainMenu)); |
tobyspark | 27:27851d3d2bba | 566 | } |
tobyspark | 27:27851d3d2bba | 567 | |
tobyspark | 27:27851d3d2bba | 568 | void setMixModeMenuItems() |
tobyspark | 27:27851d3d2bba | 569 | { |
tobyspark | 27:27851d3d2bba | 570 | mixModeMenu.clearMenuItems(); |
tobyspark | 29:95a7efe30527 | 571 | mixModeMenu.addMenuItem(SPKMenuItem("Crossfade", &mixModeAdditiveMenu)); |
tobyspark | 27:27851d3d2bba | 572 | for (int i=0; i < settings.keyerSetCount(); i++) |
tobyspark | 27:27851d3d2bba | 573 | { |
tobyspark | 36:8b5c75c8bc23 | 574 | mixModeMenu.addMenuItem(SPKMenuItem(settings.keyerParamName(i), &mixModeKeyerMenuUpdate)); |
tobyspark | 27:27851d3d2bba | 575 | } |
tobyspark | 27:27851d3d2bba | 576 | mixModeMenu.addMenuItem(SPKMenuItem("Back to Main Menu", &mainMenu)); |
tobyspark | 27:27851d3d2bba | 577 | } |
tobyspark | 27:27851d3d2bba | 578 | |
tobyspark | 27:27851d3d2bba | 579 | void setCommsMenuItems() |
tobyspark | 27:27851d3d2bba | 580 | { |
tobyspark | 27:27851d3d2bba | 581 | if (rj45Mode == rj45Ethernet) |
tobyspark | 27:27851d3d2bba | 582 | { |
tobyspark | 27:27851d3d2bba | 583 | commsMenu.title = "Network Mode [Ethernet]"; |
tobyspark | 27:27851d3d2bba | 584 | commsMenu.clearMenuItems(); |
tobyspark | 27:27851d3d2bba | 585 | commsMenu.addMenuItem(SPKMenuItem("None", commsNone)); |
tobyspark | 27:27851d3d2bba | 586 | commsMenu.addMenuItem(SPKMenuItem("OSC", commsOSC)); |
tobyspark | 27:27851d3d2bba | 587 | commsMenu.addMenuItem(SPKMenuItem("ArtNet", commsArtNet)); |
tobyspark | 27:27851d3d2bba | 588 | commsMenu.addMenuItem(SPKMenuItem("Back to Main Menu", &mainMenu)); |
tobyspark | 33:e6672a9bd571 | 589 | commsMenu = 0; |
tobyspark | 27:27851d3d2bba | 590 | } |
tobyspark | 27:27851d3d2bba | 591 | else if (rj45Mode == rj45DMX) |
tobyspark | 27:27851d3d2bba | 592 | { |
tobyspark | 27:27851d3d2bba | 593 | commsMenu.title = "Network Mode [DMX]"; |
tobyspark | 27:27851d3d2bba | 594 | commsMenu.clearMenuItems(); |
tobyspark | 27:27851d3d2bba | 595 | commsMenu.addMenuItem(SPKMenuItem("None", commsNone)); |
tobyspark | 27:27851d3d2bba | 596 | commsMenu.addMenuItem(SPKMenuItem("DMX In", commsDMXIn)); |
tobyspark | 27:27851d3d2bba | 597 | commsMenu.addMenuItem(SPKMenuItem("DMX Out", commsDMXOut)); |
tobyspark | 27:27851d3d2bba | 598 | commsMenu.addMenuItem(SPKMenuItem("Back to Main Menu", &mainMenu)); |
tobyspark | 33:e6672a9bd571 | 599 | commsMenu = 0; |
tobyspark | 27:27851d3d2bba | 600 | } |
tobyspark | 27:27851d3d2bba | 601 | } |
tobyspark | 27:27851d3d2bba | 602 | |
tobyspark | 0:87aab40d5806 | 603 | int main() |
tobyspark | 0:87aab40d5806 | 604 | { |
tobyspark | 0:87aab40d5806 | 605 | if (debug) |
tobyspark | 0:87aab40d5806 | 606 | { |
tobyspark | 0:87aab40d5806 | 607 | debug->printf("\r\n\r\n"); |
tobyspark | 0:87aab40d5806 | 608 | debug->printf("*spark d-fuser -----------\r\n"); |
tobyspark | 0:87aab40d5806 | 609 | debug->printf(" debug channel\r\n"); |
tobyspark | 0:87aab40d5806 | 610 | } |
tobyspark | 2:50043054e4f7 | 611 | |
tobyspark | 2:50043054e4f7 | 612 | // Set display font |
tobyspark | 2:50043054e4f7 | 613 | screen.fontStartCharacter = &characterBytesStartChar; |
tobyspark | 2:50043054e4f7 | 614 | screen.fontEndCharacter = &characterBytesEndChar; |
tobyspark | 2:50043054e4f7 | 615 | screen.fontCharacters = characterBytes; |
tobyspark | 2:50043054e4f7 | 616 | |
tobyspark | 0:87aab40d5806 | 617 | // Splash screen |
tobyspark | 30:873979018850 | 618 | string softwareLine = "SW "; |
tobyspark | 30:873979018850 | 619 | softwareLine += kSPKDFSoftwareVersion; |
tobyspark | 2:50043054e4f7 | 620 | screen.imageToBuffer(spkDisplayLogo); |
tobyspark | 0:87aab40d5806 | 621 | screen.textToBuffer("SPK:D-Fuser",0); |
tobyspark | 30:873979018850 | 622 | screen.textToBuffer(softwareLine,1); |
tobyspark | 5:f8b285ca41ba | 623 | screen.sendBuffer(); |
tobyspark | 0:87aab40d5806 | 624 | |
tobyspark | 11:0783cfbeb746 | 625 | // Load saved settings |
tobyspark | 16:52484666b323 | 626 | bool settingsAreCustom = false; |
tobyspark | 16:52484666b323 | 627 | settingsAreCustom = settings.load(kSPKDFSettingsFilename); |
tobyspark | 30:873979018850 | 628 | if (settingsAreCustom) |
tobyspark | 30:873979018850 | 629 | { |
tobyspark | 30:873979018850 | 630 | softwareLine += "; ini OK"; |
tobyspark | 30:873979018850 | 631 | screen.textToBuffer(softwareLine, 1); |
tobyspark | 30:873979018850 | 632 | } |
tobyspark | 30:873979018850 | 633 | |
tobyspark | 0:87aab40d5806 | 634 | // Set menu structure |
tobyspark | 0:87aab40d5806 | 635 | mixModeMenu.title = "Mix Mode"; |
tobyspark | 27:27851d3d2bba | 636 | setMixModeMenuItems(); |
tobyspark | 24:49c6624119ae | 637 | |
tobyspark | 29:95a7efe30527 | 638 | mixModeAdditiveMenu.title = "Crossfade"; |
tobyspark | 30:873979018850 | 639 | mixModeAdditiveMenu.addMenuItem(SPKMenuItem("[title overridden]", &mixModeMenu, true)); |
tobyspark | 36:8b5c75c8bc23 | 640 | |
tobyspark | 36:8b5c75c8bc23 | 641 | mixModeKeyerMenuUpdate.title = "Update Keyer Settings?"; |
tobyspark | 36:8b5c75c8bc23 | 642 | mixModeKeyerMenuUpdate.addMenuItem(SPKMenuItem("[title overridden]", &mixModeKeyerMenuMaxY, true)); |
tobyspark | 36:8b5c75c8bc23 | 643 | |
tobyspark | 36:8b5c75c8bc23 | 644 | mixModeKeyerMenuMaxY.title = "UP until lighter gone"; |
tobyspark | 36:8b5c75c8bc23 | 645 | mixModeKeyerMenuMaxY.addMenuItem(SPKMenuItem("[title overridden]", &mixModeKeyerMenuMinY, true)); |
tobyspark | 36:8b5c75c8bc23 | 646 | |
tobyspark | 36:8b5c75c8bc23 | 647 | mixModeKeyerMenuMinY.title = "UP to bring back darker"; |
tobyspark | 36:8b5c75c8bc23 | 648 | mixModeKeyerMenuMinY.addMenuItem(SPKMenuItem("[title overridden]", &mixModeKeyerMenuMaxU, true)); |
tobyspark | 36:8b5c75c8bc23 | 649 | |
tobyspark | 36:8b5c75c8bc23 | 650 | mixModeKeyerMenuMaxU.title = "UP until lighter gone"; |
tobyspark | 36:8b5c75c8bc23 | 651 | mixModeKeyerMenuMaxU.addMenuItem(SPKMenuItem("[title overridden]", &mixModeKeyerMenuMinU, true)); |
tobyspark | 36:8b5c75c8bc23 | 652 | |
tobyspark | 36:8b5c75c8bc23 | 653 | mixModeKeyerMenuMinU.title = "UP to bring back darker"; |
tobyspark | 36:8b5c75c8bc23 | 654 | mixModeKeyerMenuMinU.addMenuItem(SPKMenuItem("[title overridden]", &mixModeKeyerMenuMaxV, true)); |
tobyspark | 36:8b5c75c8bc23 | 655 | |
tobyspark | 36:8b5c75c8bc23 | 656 | mixModeKeyerMenuMaxV.title = "UP until lighter gone"; |
tobyspark | 36:8b5c75c8bc23 | 657 | mixModeKeyerMenuMaxV.addMenuItem(SPKMenuItem("[title overridden]", &mixModeKeyerMenuMinV, true)); |
tobyspark | 36:8b5c75c8bc23 | 658 | |
tobyspark | 36:8b5c75c8bc23 | 659 | mixModeKeyerMenuMinV.title = "UP to bring back darker"; |
tobyspark | 36:8b5c75c8bc23 | 660 | mixModeKeyerMenuMinV.addMenuItem(SPKMenuItem("[title overridden]", &mixModeMenu, true)); |
tobyspark | 36:8b5c75c8bc23 | 661 | |
tobyspark | 0:87aab40d5806 | 662 | |
tobyspark | 0:87aab40d5806 | 663 | resolutionMenu.title = "Resolution"; |
tobyspark | 27:27851d3d2bba | 664 | setResolutionMenuItems(); |
tobyspark | 0:87aab40d5806 | 665 | |
tobyspark | 27:27851d3d2bba | 666 | commsMenu.title = "Network Mode"; |
tobyspark | 27:27851d3d2bba | 667 | setCommsMenuItems(); |
tobyspark | 23:909928cafb95 | 668 | |
tobyspark | 15:4b394c64b461 | 669 | advancedMenu.title = "Troubleshooting"; |
tobyspark | 23:909928cafb95 | 670 | advancedMenu.addMenuItem(SPKMenuItem("HDCP Off", advancedHDCPOff)); |
tobyspark | 23:909928cafb95 | 671 | advancedMenu.addMenuItem(SPKMenuItem("HDCP On", advancedHDCPOn)); |
tobyspark | 35:d5d9f0838f99 | 672 | advancedMenu.addMenuItem(SPKMenuItem("EDID Passthrough", advancedEDIDPassthrough)); |
tobyspark | 31:01845a2347ff | 673 | advancedMenu.addMenuItem(SPKMenuItem("EDID Internal", advancedEDIDInternal)); |
tobyspark | 30:873979018850 | 674 | advancedMenu.addMenuItem(SPKMenuItem("Test Processor Sources", advancedTestSources)); |
tobyspark | 23:909928cafb95 | 675 | advancedMenu.addMenuItem(SPKMenuItem("Conform Processor", advancedConformProcessor)); |
tobyspark | 30:873979018850 | 676 | if (settingsAreCustom) advancedMenu.addMenuItem(SPKMenuItem("Revert Controller", advancedLoadDefaults)); |
tobyspark | 24:49c6624119ae | 677 | advancedMenu.addMenuItem(SPKMenuItem("Back to Main Menu", &mainMenu)); |
tobyspark | 23:909928cafb95 | 678 | |
tobyspark | 0:87aab40d5806 | 679 | mainMenu.title = "Main Menu"; |
tobyspark | 24:49c6624119ae | 680 | mainMenu.addMenuItem(SPKMenuItem(mixModeMenu.title, &mixModeMenu)); |
tobyspark | 24:49c6624119ae | 681 | mainMenu.addMenuItem(SPKMenuItem(resolutionMenu.title, &resolutionMenu)); |
tobyspark | 24:49c6624119ae | 682 | mainMenu.addMenuItem(SPKMenuItem(commsMenu.title, &commsMenu)); |
tobyspark | 24:49c6624119ae | 683 | mainMenu.addMenuItem(SPKMenuItem(advancedMenu.title, &advancedMenu)); |
tobyspark | 23:909928cafb95 | 684 | |
tobyspark | 0:87aab40d5806 | 685 | selectedMenu = &mainMenu; |
tobyspark | 23:909928cafb95 | 686 | |
tobyspark | 0:87aab40d5806 | 687 | // Misc I/O stuff |
tobyspark | 0:87aab40d5806 | 688 | |
tobyspark | 0:87aab40d5806 | 689 | fadeAPO.period(0.001); |
tobyspark | 0:87aab40d5806 | 690 | fadeBPO.period(0.001); |
tobyspark | 0:87aab40d5806 | 691 | |
tobyspark | 20:8b92d7922c48 | 692 | // Test for TV One connectivity and determine unit type |
tobyspark | 30:873979018850 | 693 | // TODO: Determine and fall back if not dfuser firmware? |
tobyspark | 30:873979018850 | 694 | // TODO: Use software version to select resolution slots? |
tobyspark | 30:873979018850 | 695 | // TODO: Use product / board type to select TVOne conform type? |
tobyspark | 21:f9d63cb7cedb | 696 | // kTV1FunctionReadSoftwareVersion |
tobyspark | 21:f9d63cb7cedb | 697 | // kTV1FunctionReadProductType |
tobyspark | 21:f9d63cb7cedb | 698 | // kTV1FunctionReadBoardType |
tobyspark | 21:f9d63cb7cedb | 699 | |
tobyspark | 12:c270870bdd23 | 700 | // Display menu and framing lines |
tobyspark | 0:87aab40d5806 | 701 | screen.horizLineToBuffer(kMenuLine1*pixInPage - 1); |
tobyspark | 0:87aab40d5806 | 702 | screen.clearBufferRow(kMenuLine1); |
tobyspark | 0:87aab40d5806 | 703 | screen.textToBuffer(selectedMenu->title, kMenuLine1); |
tobyspark | 0:87aab40d5806 | 704 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 0:87aab40d5806 | 705 | screen.textToBuffer(selectedMenu->selectedString(), kMenuLine2); |
tobyspark | 0:87aab40d5806 | 706 | screen.horizLineToBuffer(kMenuLine2*pixInPage + pixInPage); |
tobyspark | 1:f9fca21102e0 | 707 | screen.horizLineToBuffer(kCommsStatusLine*pixInPage - 1); |
tobyspark | 1:f9fca21102e0 | 708 | screen.clearBufferRow(kTVOneStatusLine); |
tobyspark | 34:69dfe64e7e6b | 709 | screen.textToBuffer("TVOne: OK", kTVOneStatusLine); // handleTVOneSources will update this |
tobyspark | 30:873979018850 | 710 | |
tobyspark | 30:873979018850 | 711 | // If we do not have two solid sources, act on this as we rely on the window having a source for crossfade behaviour |
tobyspark | 30:873979018850 | 712 | // Once we've had two solid inputs, don't check any more as we're ok as the unit is set to hold on last frame. |
tobyspark | 34:69dfe64e7e6b | 713 | bool ok = handleTVOneSources(); |
tobyspark | 33:e6672a9bd571 | 714 | |
tobyspark | 33:e6672a9bd571 | 715 | // Update display before starting mixer loop |
tobyspark | 33:e6672a9bd571 | 716 | screen.sendBuffer(); |
tobyspark | 33:e6672a9bd571 | 717 | |
tobyspark | 0:87aab40d5806 | 718 | //// CONTROLS TEST |
tobyspark | 0:87aab40d5806 | 719 | |
tobyspark | 0:87aab40d5806 | 720 | while (0) { |
tobyspark | 0:87aab40d5806 | 721 | if (debug) debug->printf("xFade: %f, fadeOut: %f, tapLeft %i, tapRight: %i encPos: %i encChange:%i encHasPressed:%i \r\n" , xFadeAIN.read(), fadeUpAIN.read(), tapLeftDIN.read(), tapRightDIN.read(), menuEnc.getPos(), menuEnc.getChange(), menuEnc.hasPressed()); |
tobyspark | 0:87aab40d5806 | 722 | } |
tobyspark | 0:87aab40d5806 | 723 | |
tobyspark | 0:87aab40d5806 | 724 | //// MIXER RUN |
tobyspark | 0:87aab40d5806 | 725 | |
tobyspark | 8:d46cc49f0f37 | 726 | while (1) |
tobyspark | 8:d46cc49f0f37 | 727 | { |
tobyspark | 35:d5d9f0838f99 | 728 | bool updateMixMode = false; |
tobyspark | 35:d5d9f0838f99 | 729 | |
tobyspark | 1:f9fca21102e0 | 730 | //// Task background things |
tobyspark | 33:e6672a9bd571 | 731 | if ((osc || artNet) && rj45Mode == rj45Ethernet) |
tobyspark | 5:f8b285ca41ba | 732 | { |
tobyspark | 5:f8b285ca41ba | 733 | Net::poll(); |
tobyspark | 5:f8b285ca41ba | 734 | } |
tobyspark | 5:f8b285ca41ba | 735 | |
tobyspark | 5:f8b285ca41ba | 736 | //// RJ45 SWITCH |
tobyspark | 5:f8b285ca41ba | 737 | |
tobyspark | 5:f8b285ca41ba | 738 | if (rj45ModeDIN != rj45Mode) |
tobyspark | 1:f9fca21102e0 | 739 | { |
tobyspark | 23:909928cafb95 | 740 | if (debug) debug->printf("Handling RJ45 mode change\r\n"); |
tobyspark | 27:27851d3d2bba | 741 | |
tobyspark | 5:f8b285ca41ba | 742 | // update state |
tobyspark | 5:f8b285ca41ba | 743 | rj45Mode = rj45ModeDIN; |
tobyspark | 27:27851d3d2bba | 744 | |
tobyspark | 27:27851d3d2bba | 745 | setCommsMenuItems(); |
tobyspark | 5:f8b285ca41ba | 746 | |
tobyspark | 5:f8b285ca41ba | 747 | // cancel old comms |
tobyspark | 5:f8b285ca41ba | 748 | commsMode = commsNone; |
tobyspark | 5:f8b285ca41ba | 749 | commsMenu = commsMode; |
tobyspark | 5:f8b285ca41ba | 750 | |
tobyspark | 5:f8b285ca41ba | 751 | // refresh display |
tobyspark | 23:909928cafb95 | 752 | if (selectedMenu == &commsMenu) |
tobyspark | 23:909928cafb95 | 753 | { |
tobyspark | 33:e6672a9bd571 | 754 | screen.clearBufferRow(kMenuLine1); |
tobyspark | 33:e6672a9bd571 | 755 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 23:909928cafb95 | 756 | screen.textToBuffer(selectedMenu->title, kMenuLine1); |
tobyspark | 23:909928cafb95 | 757 | screen.textToBuffer(selectedMenu->selectedString(), kMenuLine2); |
tobyspark | 23:909928cafb95 | 758 | } |
tobyspark | 5:f8b285ca41ba | 759 | if (rj45Mode == rj45Ethernet) screen.textToBuffer("RJ45: Ethernet Engaged", kCommsStatusLine); |
tobyspark | 5:f8b285ca41ba | 760 | if (rj45Mode == rj45DMX) screen.textToBuffer("RJ45: DMX Engaged", kCommsStatusLine); |
tobyspark | 1:f9fca21102e0 | 761 | } |
tobyspark | 1:f9fca21102e0 | 762 | |
tobyspark | 0:87aab40d5806 | 763 | //// MENU |
tobyspark | 0:87aab40d5806 | 764 | |
tobyspark | 0:87aab40d5806 | 765 | int menuChange = menuEnc.getChange(); |
tobyspark | 0:87aab40d5806 | 766 | |
tobyspark | 0:87aab40d5806 | 767 | // Update GUI |
tobyspark | 0:87aab40d5806 | 768 | if (menuChange != 0) |
tobyspark | 0:87aab40d5806 | 769 | { |
tobyspark | 24:49c6624119ae | 770 | if (selectedMenu->selectedItem().handlingControls) |
tobyspark | 24:49c6624119ae | 771 | { |
tobyspark | 24:49c6624119ae | 772 | if (selectedMenu == &mixModeAdditiveMenu) |
tobyspark | 24:49c6624119ae | 773 | { |
tobyspark | 24:49c6624119ae | 774 | fadeCurve += menuChange * 0.05; |
tobyspark | 24:49c6624119ae | 775 | if (fadeCurve > 1.0f) fadeCurve = 1.0f; |
tobyspark | 24:49c6624119ae | 776 | if (fadeCurve < 0.0f) fadeCurve = 0.0f; |
tobyspark | 29:95a7efe30527 | 777 | |
tobyspark | 31:01845a2347ff | 778 | int newMixMode = (fadeCurve > 0.0f) ? mixAdditive: mixBlend; |
tobyspark | 31:01845a2347ff | 779 | |
tobyspark | 31:01845a2347ff | 780 | if (newMixMode != mixMode) |
tobyspark | 31:01845a2347ff | 781 | { |
tobyspark | 31:01845a2347ff | 782 | mixMode = newMixMode; |
tobyspark | 35:d5d9f0838f99 | 783 | updateMixMode = true; |
tobyspark | 31:01845a2347ff | 784 | } |
tobyspark | 29:95a7efe30527 | 785 | |
tobyspark | 24:49c6624119ae | 786 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 29:95a7efe30527 | 787 | screen.textToBuffer("Blend [ ----- ] Add", kMenuLine2); |
tobyspark | 29:95a7efe30527 | 788 | screen.characterToBuffer('X', 38 + fadeCurve*20.0f, kMenuLine2); |
tobyspark | 24:49c6624119ae | 789 | |
tobyspark | 31:01845a2347ff | 790 | if (debug) debug->printf("Fade curve changed by %i to %f \r\n", menuChange, fadeCurve); |
tobyspark | 24:49c6624119ae | 791 | } |
tobyspark | 36:8b5c75c8bc23 | 792 | else if (selectedMenu == &mixModeKeyerMenuUpdate) |
tobyspark | 36:8b5c75c8bc23 | 793 | { |
tobyspark | 36:8b5c75c8bc23 | 794 | if (menuChange < 0) |
tobyspark | 36:8b5c75c8bc23 | 795 | { |
tobyspark | 36:8b5c75c8bc23 | 796 | settings.editingKeyerSetIndex = mixModeMenu.selectedIndex() - mixKeyStartIndex; |
tobyspark | 36:8b5c75c8bc23 | 797 | screen.textToBuffer("[Yes/ ]", kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 798 | } |
tobyspark | 36:8b5c75c8bc23 | 799 | else |
tobyspark | 36:8b5c75c8bc23 | 800 | { |
tobyspark | 36:8b5c75c8bc23 | 801 | settings.editingKeyerSetIndex = -1; |
tobyspark | 36:8b5c75c8bc23 | 802 | screen.textToBuffer("[ /No]", kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 803 | } |
tobyspark | 36:8b5c75c8bc23 | 804 | } |
tobyspark | 36:8b5c75c8bc23 | 805 | else if (selectedMenu == &mixModeKeyerMenuMinY) |
tobyspark | 36:8b5c75c8bc23 | 806 | { |
tobyspark | 36:8b5c75c8bc23 | 807 | int value = settings.editingKeyerSetValue(SPKSettings::minY); |
tobyspark | 36:8b5c75c8bc23 | 808 | value += menuChange; |
tobyspark | 36:8b5c75c8bc23 | 809 | if (value < 0) value = 0; |
tobyspark | 36:8b5c75c8bc23 | 810 | if (value > settings.editingKeyerSetValue(SPKSettings::maxY)) value = settings.editingKeyerSetValue(SPKSettings::maxY); |
tobyspark | 36:8b5c75c8bc23 | 811 | settings.setEditingKeyerSetValue(SPKSettings::minY, value); |
tobyspark | 36:8b5c75c8bc23 | 812 | |
tobyspark | 36:8b5c75c8bc23 | 813 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 814 | |
tobyspark | 36:8b5c75c8bc23 | 815 | char paramLine[kStringBufferLength]; |
tobyspark | 37:744bef2e8be8 | 816 | snprintf(paramLine, kStringBufferLength, "[%3i/%3i][ / ][ / ]", value, |
tobyspark | 37:744bef2e8be8 | 817 | settings.editingKeyerSetValue(SPKSettings::maxY)); |
tobyspark | 36:8b5c75c8bc23 | 818 | screen.textToBuffer(paramLine, kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 819 | |
tobyspark | 36:8b5c75c8bc23 | 820 | tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerMinY, value); |
tobyspark | 36:8b5c75c8bc23 | 821 | } |
tobyspark | 36:8b5c75c8bc23 | 822 | else if (selectedMenu == &mixModeKeyerMenuMaxY) |
tobyspark | 36:8b5c75c8bc23 | 823 | { |
tobyspark | 36:8b5c75c8bc23 | 824 | int value = settings.editingKeyerSetValue(SPKSettings::maxY); |
tobyspark | 36:8b5c75c8bc23 | 825 | value += menuChange; |
tobyspark | 36:8b5c75c8bc23 | 826 | if (value < 0) value = 0; |
tobyspark | 36:8b5c75c8bc23 | 827 | if (value > 255) value = 255; |
tobyspark | 36:8b5c75c8bc23 | 828 | settings.setEditingKeyerSetValue(SPKSettings::maxY, value); |
tobyspark | 36:8b5c75c8bc23 | 829 | |
tobyspark | 36:8b5c75c8bc23 | 830 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 831 | |
tobyspark | 36:8b5c75c8bc23 | 832 | char paramLine[kStringBufferLength]; |
tobyspark | 36:8b5c75c8bc23 | 833 | snprintf(paramLine, kStringBufferLength, "[ /%3i][ / ][ / ]", value); |
tobyspark | 36:8b5c75c8bc23 | 834 | screen.textToBuffer(paramLine, kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 835 | |
tobyspark | 36:8b5c75c8bc23 | 836 | tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerMaxY, value); |
tobyspark | 36:8b5c75c8bc23 | 837 | } |
tobyspark | 36:8b5c75c8bc23 | 838 | else if (selectedMenu == &mixModeKeyerMenuMinU) |
tobyspark | 36:8b5c75c8bc23 | 839 | { |
tobyspark | 36:8b5c75c8bc23 | 840 | int value = settings.editingKeyerSetValue(SPKSettings::minU); |
tobyspark | 36:8b5c75c8bc23 | 841 | value += menuChange; |
tobyspark | 36:8b5c75c8bc23 | 842 | if (value > settings.editingKeyerSetValue(SPKSettings::maxU)) value = settings.editingKeyerSetValue(SPKSettings::maxU); |
tobyspark | 36:8b5c75c8bc23 | 843 | if (value > 255) value = 255; |
tobyspark | 36:8b5c75c8bc23 | 844 | settings.setEditingKeyerSetValue(SPKSettings::minU, value); |
tobyspark | 36:8b5c75c8bc23 | 845 | |
tobyspark | 36:8b5c75c8bc23 | 846 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 847 | |
tobyspark | 36:8b5c75c8bc23 | 848 | char paramLine[kStringBufferLength]; |
tobyspark | 36:8b5c75c8bc23 | 849 | snprintf(paramLine, kStringBufferLength, "[%3i/%3i][%3i/%3i][ / ]", settings.editingKeyerSetValue(SPKSettings::minY), |
tobyspark | 36:8b5c75c8bc23 | 850 | settings.editingKeyerSetValue(SPKSettings::maxY), |
tobyspark | 37:744bef2e8be8 | 851 | value, |
tobyspark | 37:744bef2e8be8 | 852 | settings.editingKeyerSetValue(SPKSettings::maxU)); |
tobyspark | 36:8b5c75c8bc23 | 853 | screen.textToBuffer(paramLine, kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 854 | |
tobyspark | 36:8b5c75c8bc23 | 855 | tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerMinU, value); |
tobyspark | 36:8b5c75c8bc23 | 856 | } |
tobyspark | 36:8b5c75c8bc23 | 857 | else if (selectedMenu == &mixModeKeyerMenuMaxU) |
tobyspark | 36:8b5c75c8bc23 | 858 | { |
tobyspark | 36:8b5c75c8bc23 | 859 | int value = settings.editingKeyerSetValue(SPKSettings::maxU); |
tobyspark | 36:8b5c75c8bc23 | 860 | value += menuChange; |
tobyspark | 36:8b5c75c8bc23 | 861 | if (value < 0) value = 0; |
tobyspark | 36:8b5c75c8bc23 | 862 | if (value > 255) value = 255; |
tobyspark | 36:8b5c75c8bc23 | 863 | settings.setEditingKeyerSetValue(SPKSettings::maxU, value); |
tobyspark | 36:8b5c75c8bc23 | 864 | |
tobyspark | 36:8b5c75c8bc23 | 865 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 866 | |
tobyspark | 36:8b5c75c8bc23 | 867 | char paramLine[kStringBufferLength]; |
tobyspark | 36:8b5c75c8bc23 | 868 | snprintf(paramLine, kStringBufferLength, "[%3i/%3i][ /%3i][ / ]", settings.editingKeyerSetValue(SPKSettings::minY), |
tobyspark | 36:8b5c75c8bc23 | 869 | settings.editingKeyerSetValue(SPKSettings::maxY), |
tobyspark | 36:8b5c75c8bc23 | 870 | value); |
tobyspark | 36:8b5c75c8bc23 | 871 | screen.textToBuffer(paramLine, kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 872 | |
tobyspark | 36:8b5c75c8bc23 | 873 | tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerMaxU, value); |
tobyspark | 36:8b5c75c8bc23 | 874 | } |
tobyspark | 36:8b5c75c8bc23 | 875 | else if (selectedMenu == &mixModeKeyerMenuMinV) |
tobyspark | 36:8b5c75c8bc23 | 876 | { |
tobyspark | 36:8b5c75c8bc23 | 877 | int value = settings.editingKeyerSetValue(SPKSettings::minV); |
tobyspark | 36:8b5c75c8bc23 | 878 | value += menuChange; |
tobyspark | 36:8b5c75c8bc23 | 879 | if (value > settings.editingKeyerSetValue(SPKSettings::maxV)) value = settings.editingKeyerSetValue(SPKSettings::maxV); |
tobyspark | 36:8b5c75c8bc23 | 880 | if (value > 255) value = 255; |
tobyspark | 36:8b5c75c8bc23 | 881 | settings.setEditingKeyerSetValue(SPKSettings::minV, value); |
tobyspark | 36:8b5c75c8bc23 | 882 | |
tobyspark | 36:8b5c75c8bc23 | 883 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 884 | |
tobyspark | 36:8b5c75c8bc23 | 885 | char paramLine[kStringBufferLength]; |
tobyspark | 36:8b5c75c8bc23 | 886 | snprintf(paramLine, kStringBufferLength, "[%3i/%3i][%3i/%3i][%3i/%3i]", settings.editingKeyerSetValue(SPKSettings::minY), |
tobyspark | 36:8b5c75c8bc23 | 887 | settings.editingKeyerSetValue(SPKSettings::maxY), |
tobyspark | 36:8b5c75c8bc23 | 888 | settings.editingKeyerSetValue(SPKSettings::minU), |
tobyspark | 37:744bef2e8be8 | 889 | settings.editingKeyerSetValue(SPKSettings::maxU), |
tobyspark | 37:744bef2e8be8 | 890 | value, |
tobyspark | 37:744bef2e8be8 | 891 | settings.editingKeyerSetValue(SPKSettings::maxV)); |
tobyspark | 36:8b5c75c8bc23 | 892 | screen.textToBuffer(paramLine, kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 893 | |
tobyspark | 36:8b5c75c8bc23 | 894 | tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerMinV, value); |
tobyspark | 36:8b5c75c8bc23 | 895 | } |
tobyspark | 36:8b5c75c8bc23 | 896 | else if (selectedMenu == &mixModeKeyerMenuMaxV) |
tobyspark | 36:8b5c75c8bc23 | 897 | { |
tobyspark | 36:8b5c75c8bc23 | 898 | int value = settings.editingKeyerSetValue(SPKSettings::maxV); |
tobyspark | 36:8b5c75c8bc23 | 899 | value += menuChange; |
tobyspark | 36:8b5c75c8bc23 | 900 | if (value < 0) value = 0; |
tobyspark | 36:8b5c75c8bc23 | 901 | if (value > 255) value = 255; |
tobyspark | 36:8b5c75c8bc23 | 902 | settings.setEditingKeyerSetValue(SPKSettings::maxV, value); |
tobyspark | 36:8b5c75c8bc23 | 903 | |
tobyspark | 36:8b5c75c8bc23 | 904 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 905 | |
tobyspark | 36:8b5c75c8bc23 | 906 | char paramLine[kStringBufferLength]; |
tobyspark | 36:8b5c75c8bc23 | 907 | snprintf(paramLine, kStringBufferLength, "[%3i/%3i][%3i/%3i][ /%3i]", settings.editingKeyerSetValue(SPKSettings::minY), |
tobyspark | 36:8b5c75c8bc23 | 908 | settings.editingKeyerSetValue(SPKSettings::maxY), |
tobyspark | 36:8b5c75c8bc23 | 909 | settings.editingKeyerSetValue(SPKSettings::minU), |
tobyspark | 36:8b5c75c8bc23 | 910 | settings.editingKeyerSetValue(SPKSettings::maxU), |
tobyspark | 36:8b5c75c8bc23 | 911 | value); |
tobyspark | 36:8b5c75c8bc23 | 912 | screen.textToBuffer(paramLine, kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 913 | |
tobyspark | 36:8b5c75c8bc23 | 914 | tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerMaxV, value); |
tobyspark | 36:8b5c75c8bc23 | 915 | } |
tobyspark | 24:49c6624119ae | 916 | } |
tobyspark | 24:49c6624119ae | 917 | else |
tobyspark | 24:49c6624119ae | 918 | { |
tobyspark | 24:49c6624119ae | 919 | if (debug) debug->printf("Menu changed by %i\r\n", menuChange); |
tobyspark | 24:49c6624119ae | 920 | |
tobyspark | 24:49c6624119ae | 921 | *selectedMenu = selectedMenu->selectedIndex() + menuChange; |
tobyspark | 24:49c6624119ae | 922 | |
tobyspark | 24:49c6624119ae | 923 | // update OLED line 2 here |
tobyspark | 24:49c6624119ae | 924 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 24:49c6624119ae | 925 | screen.textToBuffer(selectedMenu->selectedString(), kMenuLine2); |
tobyspark | 24:49c6624119ae | 926 | |
tobyspark | 24:49c6624119ae | 927 | if (debug) debug->printf("%s \r\n", selectedMenu->selectedString().c_str()); |
tobyspark | 24:49c6624119ae | 928 | } |
tobyspark | 0:87aab40d5806 | 929 | } |
tobyspark | 0:87aab40d5806 | 930 | |
tobyspark | 0:87aab40d5806 | 931 | // Action menu item |
tobyspark | 0:87aab40d5806 | 932 | if (menuEnc.hasPressed()) |
tobyspark | 0:87aab40d5806 | 933 | { |
tobyspark | 0:87aab40d5806 | 934 | if (debug) debug->printf("Action Menu Item!\r\n"); |
tobyspark | 21:f9d63cb7cedb | 935 | |
tobyspark | 0:87aab40d5806 | 936 | // Are we changing menus? |
tobyspark | 23:909928cafb95 | 937 | if (selectedMenu->selectedItem().type == SPKMenuItem::changesToMenu) |
tobyspark | 0:87aab40d5806 | 938 | { |
tobyspark | 31:01845a2347ff | 939 | // If we're exiting the menu, we should set its selected index back to the menu's beginning... |
tobyspark | 31:01845a2347ff | 940 | SPKMenu* menuToReset = selectedMenu->selectedItem().payload.menu == &mainMenu? selectedMenu : NULL; |
tobyspark | 31:01845a2347ff | 941 | |
tobyspark | 31:01845a2347ff | 942 | // point selected menu pointer to the new menu pointer |
tobyspark | 23:909928cafb95 | 943 | selectedMenu = selectedMenu->selectedItem().payload.menu; |
tobyspark | 0:87aab40d5806 | 944 | |
tobyspark | 31:01845a2347ff | 945 | // ...doing this, of course, after we've used the value |
tobyspark | 31:01845a2347ff | 946 | if (menuToReset) *menuToReset = 0; |
tobyspark | 31:01845a2347ff | 947 | |
tobyspark | 0:87aab40d5806 | 948 | // update OLED lines 1&2 |
tobyspark | 0:87aab40d5806 | 949 | screen.clearBufferRow(kMenuLine1); |
tobyspark | 0:87aab40d5806 | 950 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 0:87aab40d5806 | 951 | screen.textToBuffer(selectedMenu->title, kMenuLine1); |
tobyspark | 0:87aab40d5806 | 952 | screen.textToBuffer(selectedMenu->selectedString(), kMenuLine2); |
tobyspark | 0:87aab40d5806 | 953 | |
tobyspark | 0:87aab40d5806 | 954 | if (debug) |
tobyspark | 0:87aab40d5806 | 955 | { |
tobyspark | 0:87aab40d5806 | 956 | debug->printf("\r\n"); |
tobyspark | 0:87aab40d5806 | 957 | debug->printf("%s \r\n", selectedMenu->title.c_str()); |
tobyspark | 0:87aab40d5806 | 958 | debug->printf("%s \r\n", selectedMenu->selectedString().c_str()); |
tobyspark | 0:87aab40d5806 | 959 | } |
tobyspark | 24:49c6624119ae | 960 | |
tobyspark | 24:49c6624119ae | 961 | // Are we changing menus that should have a command attached? |
tobyspark | 24:49c6624119ae | 962 | if (selectedMenu == &mixModeAdditiveMenu) |
tobyspark | 24:49c6624119ae | 963 | { |
tobyspark | 29:95a7efe30527 | 964 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 29:95a7efe30527 | 965 | screen.textToBuffer("Blend [ ----- ] Add", kMenuLine2); |
tobyspark | 29:95a7efe30527 | 966 | screen.characterToBuffer('X', 38 + fadeCurve*20.0f, kMenuLine2); |
tobyspark | 29:95a7efe30527 | 967 | |
tobyspark | 29:95a7efe30527 | 968 | mixMode = fadeCurve > 0 ? mixAdditive : mixBlend; |
tobyspark | 35:d5d9f0838f99 | 969 | updateMixMode = true; |
tobyspark | 24:49c6624119ae | 970 | } |
tobyspark | 36:8b5c75c8bc23 | 971 | else if (selectedMenu == &mixModeKeyerMenuUpdate) |
tobyspark | 36:8b5c75c8bc23 | 972 | { |
tobyspark | 36:8b5c75c8bc23 | 973 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 974 | if (settings.editingKeyerSetIndex == mixModeMenu.selectedIndex() - mixKeyStartIndex) |
tobyspark | 36:8b5c75c8bc23 | 975 | screen.textToBuffer("[Yes/ ]", kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 976 | else |
tobyspark | 36:8b5c75c8bc23 | 977 | screen.textToBuffer("[ /No]", kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 978 | |
tobyspark | 36:8b5c75c8bc23 | 979 | mixMode = mixKey; |
tobyspark | 36:8b5c75c8bc23 | 980 | updateMixMode = true; |
tobyspark | 36:8b5c75c8bc23 | 981 | } |
tobyspark | 36:8b5c75c8bc23 | 982 | else if (selectedMenu == &mixModeKeyerMenuMinY) |
tobyspark | 36:8b5c75c8bc23 | 983 | { |
tobyspark | 36:8b5c75c8bc23 | 984 | char paramLine[kStringBufferLength]; |
tobyspark | 36:8b5c75c8bc23 | 985 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 986 | snprintf(paramLine, kStringBufferLength, "[%3i/%3i][ / ][ / ]", settings.editingKeyerSetValue(SPKSettings::minY), |
tobyspark | 36:8b5c75c8bc23 | 987 | settings.editingKeyerSetValue(SPKSettings::maxY)); |
tobyspark | 36:8b5c75c8bc23 | 988 | screen.textToBuffer(paramLine, kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 989 | } |
tobyspark | 36:8b5c75c8bc23 | 990 | else if (selectedMenu == &mixModeKeyerMenuMaxY) |
tobyspark | 36:8b5c75c8bc23 | 991 | { |
tobyspark | 36:8b5c75c8bc23 | 992 | // First, check outcome of menu that got us here: mixModeKeyerMenuUpdate |
tobyspark | 36:8b5c75c8bc23 | 993 | if (settings.editingKeyerSetIndex == -1) |
tobyspark | 36:8b5c75c8bc23 | 994 | { |
tobyspark | 36:8b5c75c8bc23 | 995 | selectedMenu = &mixModeMenu; |
tobyspark | 36:8b5c75c8bc23 | 996 | |
tobyspark | 36:8b5c75c8bc23 | 997 | // update OLED lines 1&2 |
tobyspark | 36:8b5c75c8bc23 | 998 | screen.clearBufferRow(kMenuLine1); |
tobyspark | 36:8b5c75c8bc23 | 999 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 1000 | screen.textToBuffer(selectedMenu->title, kMenuLine1); |
tobyspark | 36:8b5c75c8bc23 | 1001 | screen.textToBuffer(selectedMenu->selectedString(), kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 1002 | } |
tobyspark | 36:8b5c75c8bc23 | 1003 | else |
tobyspark | 36:8b5c75c8bc23 | 1004 | { |
tobyspark | 36:8b5c75c8bc23 | 1005 | char paramLine[kStringBufferLength]; |
tobyspark | 36:8b5c75c8bc23 | 1006 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 1007 | snprintf(paramLine, kStringBufferLength, "[ /%3i][ / ][ / ]", settings.editingKeyerSetValue(SPKSettings::maxY)); |
tobyspark | 36:8b5c75c8bc23 | 1008 | screen.textToBuffer(paramLine, kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 1009 | } |
tobyspark | 36:8b5c75c8bc23 | 1010 | } |
tobyspark | 36:8b5c75c8bc23 | 1011 | else if (selectedMenu == &mixModeKeyerMenuMinU) |
tobyspark | 36:8b5c75c8bc23 | 1012 | { |
tobyspark | 36:8b5c75c8bc23 | 1013 | char paramLine[kStringBufferLength]; |
tobyspark | 36:8b5c75c8bc23 | 1014 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 1015 | snprintf(paramLine, kStringBufferLength, "[%3i/%3i][%3i/%3i][ / ]", settings.editingKeyerSetValue(SPKSettings::minY), |
tobyspark | 36:8b5c75c8bc23 | 1016 | settings.editingKeyerSetValue(SPKSettings::maxY), |
tobyspark | 36:8b5c75c8bc23 | 1017 | settings.editingKeyerSetValue(SPKSettings::minU), |
tobyspark | 36:8b5c75c8bc23 | 1018 | settings.editingKeyerSetValue(SPKSettings::maxU)); |
tobyspark | 36:8b5c75c8bc23 | 1019 | screen.textToBuffer(paramLine, kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 1020 | } |
tobyspark | 36:8b5c75c8bc23 | 1021 | else if (selectedMenu == &mixModeKeyerMenuMaxU) |
tobyspark | 36:8b5c75c8bc23 | 1022 | { |
tobyspark | 36:8b5c75c8bc23 | 1023 | char paramLine[kStringBufferLength]; |
tobyspark | 36:8b5c75c8bc23 | 1024 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 1025 | snprintf(paramLine, kStringBufferLength, "[%3i/%3i][ /%3i][ / ]", settings.editingKeyerSetValue(SPKSettings::minY), |
tobyspark | 36:8b5c75c8bc23 | 1026 | settings.editingKeyerSetValue(SPKSettings::maxY), |
tobyspark | 36:8b5c75c8bc23 | 1027 | settings.editingKeyerSetValue(SPKSettings::maxU)); |
tobyspark | 36:8b5c75c8bc23 | 1028 | screen.textToBuffer(paramLine, kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 1029 | } |
tobyspark | 36:8b5c75c8bc23 | 1030 | else if (selectedMenu == &mixModeKeyerMenuMinV) |
tobyspark | 36:8b5c75c8bc23 | 1031 | { |
tobyspark | 36:8b5c75c8bc23 | 1032 | char paramLine[kStringBufferLength]; |
tobyspark | 36:8b5c75c8bc23 | 1033 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 1034 | snprintf(paramLine, kStringBufferLength, "[%3i/%3i][%3i/%3i][%3i/%3i]", settings.editingKeyerSetValue(SPKSettings::minY), |
tobyspark | 36:8b5c75c8bc23 | 1035 | settings.editingKeyerSetValue(SPKSettings::maxY), |
tobyspark | 36:8b5c75c8bc23 | 1036 | settings.editingKeyerSetValue(SPKSettings::minU), |
tobyspark | 36:8b5c75c8bc23 | 1037 | settings.editingKeyerSetValue(SPKSettings::maxU), |
tobyspark | 36:8b5c75c8bc23 | 1038 | settings.editingKeyerSetValue(SPKSettings::minV), |
tobyspark | 36:8b5c75c8bc23 | 1039 | settings.editingKeyerSetValue(SPKSettings::maxV)); |
tobyspark | 36:8b5c75c8bc23 | 1040 | screen.textToBuffer(paramLine, kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 1041 | } |
tobyspark | 36:8b5c75c8bc23 | 1042 | else if (selectedMenu == &mixModeKeyerMenuMaxV) |
tobyspark | 36:8b5c75c8bc23 | 1043 | { |
tobyspark | 36:8b5c75c8bc23 | 1044 | char paramLine[kStringBufferLength]; |
tobyspark | 36:8b5c75c8bc23 | 1045 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 1046 | snprintf(paramLine, kStringBufferLength, "[%3i/%3i][%3i/%3i][ /%3i]", settings.editingKeyerSetValue(SPKSettings::minY), |
tobyspark | 36:8b5c75c8bc23 | 1047 | settings.editingKeyerSetValue(SPKSettings::maxY), |
tobyspark | 36:8b5c75c8bc23 | 1048 | settings.editingKeyerSetValue(SPKSettings::minU), |
tobyspark | 36:8b5c75c8bc23 | 1049 | settings.editingKeyerSetValue(SPKSettings::maxU), |
tobyspark | 36:8b5c75c8bc23 | 1050 | settings.editingKeyerSetValue(SPKSettings::maxV)); |
tobyspark | 36:8b5c75c8bc23 | 1051 | screen.textToBuffer(paramLine, kMenuLine2); |
tobyspark | 36:8b5c75c8bc23 | 1052 | } |
tobyspark | 0:87aab40d5806 | 1053 | } |
tobyspark | 0:87aab40d5806 | 1054 | // With that out of the way, we should be actioning a specific menu's payload? |
tobyspark | 0:87aab40d5806 | 1055 | else if (selectedMenu == &resolutionMenu) |
tobyspark | 0:87aab40d5806 | 1056 | { |
tobyspark | 9:f83eadd8917a | 1057 | bool ok = true; |
tobyspark | 0:87aab40d5806 | 1058 | |
tobyspark | 23:909928cafb95 | 1059 | ok = tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustOutputsOutputResolution, resolutionMenu.selectedItem().payload.command[0]); |
tobyspark | 31:01845a2347ff | 1060 | |
tobyspark | 31:01845a2347ff | 1061 | int32_t slot = tvOneEDIDPassthrough ? EDIDPassthroughSlot : resolutionMenu.selectedItem().payload.command[1]; |
tobyspark | 31:01845a2347ff | 1062 | |
tobyspark | 31:01845a2347ff | 1063 | ok = ok && tvOne.command(kTV1SourceRGB1, kTV1WindowIDA, kTV1FunctionAdjustSourceEDID, slot); |
tobyspark | 31:01845a2347ff | 1064 | ok = ok && tvOne.command(kTV1SourceRGB2, kTV1WindowIDA, kTV1FunctionAdjustSourceEDID, slot); |
tobyspark | 0:87aab40d5806 | 1065 | |
tobyspark | 35:d5d9f0838f99 | 1066 | // Save new resolution and EDID into TV One unit for power-on. Cycling TV One power sometimes needed for EDID. Pffft. |
tobyspark | 35:d5d9f0838f99 | 1067 | if (ok) ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionPowerOnPresetStore, 1); |
tobyspark | 35:d5d9f0838f99 | 1068 | |
tobyspark | 25:3b519ef70341 | 1069 | string sentOK; |
tobyspark | 0:87aab40d5806 | 1070 | if (ok) sentOK = "Sent: "; |
tobyspark | 0:87aab40d5806 | 1071 | else sentOK = "Send Error: "; |
tobyspark | 0:87aab40d5806 | 1072 | |
tobyspark | 26:0299f8760715 | 1073 | char sentMSGBuffer[kStringBufferLength]; |
tobyspark | 26:0299f8760715 | 1074 | snprintf(sentMSGBuffer, kStringBufferLength,"Res %i, EDID %i", resolutionMenu.selectedItem().payload.command[0], resolutionMenu.selectedItem().payload.command[1]); |
tobyspark | 0:87aab40d5806 | 1075 | |
tobyspark | 1:f9fca21102e0 | 1076 | screen.clearBufferRow(kTVOneStatusLine); |
tobyspark | 25:3b519ef70341 | 1077 | screen.textToBuffer(sentOK + sentMSGBuffer, kTVOneStatusLine); |
tobyspark | 0:87aab40d5806 | 1078 | |
tobyspark | 0:87aab40d5806 | 1079 | if (debug) { debug->printf("Changing resolution"); } |
tobyspark | 0:87aab40d5806 | 1080 | } |
tobyspark | 1:f9fca21102e0 | 1081 | else if (selectedMenu == &commsMenu) |
tobyspark | 1:f9fca21102e0 | 1082 | { |
tobyspark | 26:0299f8760715 | 1083 | string commsTypeString = "Network:"; |
tobyspark | 26:0299f8760715 | 1084 | char commsStatusBuffer[kStringBufferLength] = "--"; |
tobyspark | 1:f9fca21102e0 | 1085 | |
tobyspark | 1:f9fca21102e0 | 1086 | // Tear down any existing comms |
tobyspark | 1:f9fca21102e0 | 1087 | // This is the action of commsNone |
tobyspark | 1:f9fca21102e0 | 1088 | // And also clears the way for other comms actions |
tobyspark | 26:0299f8760715 | 1089 | commsMode = commsNone; |
tobyspark | 5:f8b285ca41ba | 1090 | if (osc) {delete osc; osc = NULL;} |
tobyspark | 5:f8b285ca41ba | 1091 | if (ethernet) {delete ethernet; ethernet = NULL;} |
tobyspark | 33:e6672a9bd571 | 1092 | if (artNet) |
tobyspark | 33:e6672a9bd571 | 1093 | { |
tobyspark | 33:e6672a9bd571 | 1094 | artNet->ArtPollReply.NumPorts = 0; |
tobyspark | 33:e6672a9bd571 | 1095 | strcpy(artNet->ArtPollReply.NodeReport, "Shutdown"); |
tobyspark | 33:e6672a9bd571 | 1096 | artNet->SendArtPollReply(); |
tobyspark | 33:e6672a9bd571 | 1097 | artNet->Done(); |
tobyspark | 33:e6672a9bd571 | 1098 | delete artNet; |
tobyspark | 33:e6672a9bd571 | 1099 | artNet = NULL; |
tobyspark | 33:e6672a9bd571 | 1100 | } |
tobyspark | 5:f8b285ca41ba | 1101 | if (dmx) {delete dmx; dmx = NULL;} |
tobyspark | 5:f8b285ca41ba | 1102 | |
tobyspark | 5:f8b285ca41ba | 1103 | // Ensure we can't change to comms modes the hardware isn't switched to |
tobyspark | 23:909928cafb95 | 1104 | if (rj45Mode == rj45DMX && (commsMenu.selectedItem().payload.command[0] == commsOSC || commsMenu.selectedItem().payload.command[0] == commsArtNet)) |
tobyspark | 1:f9fca21102e0 | 1105 | { |
tobyspark | 5:f8b285ca41ba | 1106 | commsTypeString = "RJ45 not in Ethernet mode"; |
tobyspark | 5:f8b285ca41ba | 1107 | } |
tobyspark | 23:909928cafb95 | 1108 | else if (rj45Mode == rj45Ethernet && (commsMenu.selectedItem().payload.command[0] == commsDMXIn || commsMenu.selectedItem().payload.command[0] == commsDMXOut)) |
tobyspark | 5:f8b285ca41ba | 1109 | { |
tobyspark | 5:f8b285ca41ba | 1110 | commsTypeString = "RJ45 not in DMX mode"; |
tobyspark | 5:f8b285ca41ba | 1111 | } |
tobyspark | 5:f8b285ca41ba | 1112 | // Action! |
tobyspark | 23:909928cafb95 | 1113 | else if (commsMenu.selectedItem().payload.command[0] == commsOSC) |
tobyspark | 5:f8b285ca41ba | 1114 | { |
tobyspark | 5:f8b285ca41ba | 1115 | commsMode = commsOSC; |
tobyspark | 5:f8b285ca41ba | 1116 | commsTypeString = "OSC: "; |
tobyspark | 1:f9fca21102e0 | 1117 | |
tobyspark | 1:f9fca21102e0 | 1118 | ethernet = new EthernetNetIf( |
tobyspark | 1:f9fca21102e0 | 1119 | IpAddr(kOSCMbedIPAddress), |
tobyspark | 1:f9fca21102e0 | 1120 | IpAddr(kOSCMbedSubnetMask), |
tobyspark | 1:f9fca21102e0 | 1121 | IpAddr(kOSCMbedGateway), |
tobyspark | 1:f9fca21102e0 | 1122 | IpAddr(kOSCMbedDNS) |
tobyspark | 1:f9fca21102e0 | 1123 | ); |
tobyspark | 3:033d2b7768f3 | 1124 | |
tobyspark | 1:f9fca21102e0 | 1125 | EthernetErr ethError = ethernet->setup(); |
tobyspark | 1:f9fca21102e0 | 1126 | if(ethError) |
tobyspark | 1:f9fca21102e0 | 1127 | { |
tobyspark | 1:f9fca21102e0 | 1128 | if (debug) debug->printf("Ethernet setup error, %d", ethError); |
tobyspark | 26:0299f8760715 | 1129 | snprintf(commsStatusBuffer, kStringBufferLength, "Ethernet setup failed"); |
tobyspark | 5:f8b285ca41ba | 1130 | commsMenu = commsNone; |
tobyspark | 1:f9fca21102e0 | 1131 | // break out of here. this setup should be a function that returns a boolean |
tobyspark | 1:f9fca21102e0 | 1132 | } |
tobyspark | 1:f9fca21102e0 | 1133 | |
tobyspark | 1:f9fca21102e0 | 1134 | osc = new OSCClass(); |
tobyspark | 33:e6672a9bd571 | 1135 | osc->setReceiveMessage(&receiveMessage); |
tobyspark | 1:f9fca21102e0 | 1136 | osc->begin(kOSCMbedPort); |
tobyspark | 1:f9fca21102e0 | 1137 | |
tobyspark | 26:0299f8760715 | 1138 | snprintf(commsStatusBuffer, kStringBufferLength, "Listening on %i", kOSCMbedPort); |
tobyspark | 1:f9fca21102e0 | 1139 | } |
tobyspark | 23:909928cafb95 | 1140 | else if (commsMenu.selectedItem().payload.command[0] == commsArtNet) |
tobyspark | 1:f9fca21102e0 | 1141 | { |
tobyspark | 5:f8b285ca41ba | 1142 | commsMode = commsArtNet; |
tobyspark | 5:f8b285ca41ba | 1143 | commsTypeString = "ArtNet: "; |
tobyspark | 3:033d2b7768f3 | 1144 | |
tobyspark | 3:033d2b7768f3 | 1145 | artNet = new DmxArtNet(); |
tobyspark | 1:f9fca21102e0 | 1146 | |
tobyspark | 3:033d2b7768f3 | 1147 | artNet->BindIpAddress = IpAddr(kArtNetBindIPAddress); |
tobyspark | 3:033d2b7768f3 | 1148 | artNet->BCastAddress = IpAddr(kArtNetBroadcastAddress); |
tobyspark | 3:033d2b7768f3 | 1149 | |
tobyspark | 3:033d2b7768f3 | 1150 | artNet->InitArtPollReplyDefaults(); |
tobyspark | 3:033d2b7768f3 | 1151 | |
tobyspark | 33:e6672a9bd571 | 1152 | artNet->ArtPollReply.PortType[0] = 128; // Bit 7 = Set is this channel can output data from the Art-Net Network. |
tobyspark | 33:e6672a9bd571 | 1153 | artNet->ArtPollReply.GoodOutput[0] = 128; // Bit 7 = Set – Data is being transmitted. |
tobyspark | 33:e6672a9bd571 | 1154 | artNet->ArtPollReply.PortType[2] = 64; // Bit 6 = Set if this channel can input onto the Art-NetNetwork. |
tobyspark | 33:e6672a9bd571 | 1155 | artNet->ArtPollReply.GoodInput[2] = 128; // Bit 7 = Set – Data received. |
tobyspark | 3:033d2b7768f3 | 1156 | |
tobyspark | 3:033d2b7768f3 | 1157 | artNet->Init(); |
tobyspark | 3:033d2b7768f3 | 1158 | artNet->SendArtPollReply(); // announce to art-net nodes |
tobyspark | 3:033d2b7768f3 | 1159 | |
tobyspark | 26:0299f8760715 | 1160 | snprintf(commsStatusBuffer, kStringBufferLength, "Listening"); |
tobyspark | 1:f9fca21102e0 | 1161 | } |
tobyspark | 23:909928cafb95 | 1162 | else if (commsMenu.selectedItem().payload.command[0] == commsDMXIn) |
tobyspark | 1:f9fca21102e0 | 1163 | { |
tobyspark | 5:f8b285ca41ba | 1164 | commsMode = commsDMXIn; |
tobyspark | 5:f8b285ca41ba | 1165 | commsTypeString = "DMX In: "; |
tobyspark | 1:f9fca21102e0 | 1166 | |
tobyspark | 5:f8b285ca41ba | 1167 | dmxDirectionDOUT = 0; |
tobyspark | 5:f8b285ca41ba | 1168 | |
tobyspark | 5:f8b285ca41ba | 1169 | dmx = new DMX(kMBED_RS485_TTLTX, kMBED_RS485_TTLRX); |
tobyspark | 1:f9fca21102e0 | 1170 | } |
tobyspark | 23:909928cafb95 | 1171 | else if (commsMenu.selectedItem().payload.command[0] == commsDMXOut) |
tobyspark | 5:f8b285ca41ba | 1172 | { |
tobyspark | 5:f8b285ca41ba | 1173 | commsMode = commsDMXOut; |
tobyspark | 5:f8b285ca41ba | 1174 | commsTypeString = "DMX Out: "; |
tobyspark | 5:f8b285ca41ba | 1175 | |
tobyspark | 5:f8b285ca41ba | 1176 | dmxDirectionDOUT = 1; |
tobyspark | 5:f8b285ca41ba | 1177 | |
tobyspark | 5:f8b285ca41ba | 1178 | dmx = new DMX(kMBED_RS485_TTLTX, kMBED_RS485_TTLRX); |
tobyspark | 5:f8b285ca41ba | 1179 | } |
tobyspark | 5:f8b285ca41ba | 1180 | |
tobyspark | 1:f9fca21102e0 | 1181 | screen.clearBufferRow(kCommsStatusLine); |
tobyspark | 25:3b519ef70341 | 1182 | screen.textToBuffer(commsTypeString + commsStatusBuffer, kCommsStatusLine); |
tobyspark | 1:f9fca21102e0 | 1183 | } |
tobyspark | 12:c270870bdd23 | 1184 | else if (selectedMenu == &advancedMenu) |
tobyspark | 12:c270870bdd23 | 1185 | { |
tobyspark | 23:909928cafb95 | 1186 | if (advancedMenu.selectedItem().payload.command[0] == advancedHDCPOff) |
tobyspark | 12:c270870bdd23 | 1187 | { |
tobyspark | 31:01845a2347ff | 1188 | bool ok; |
tobyspark | 12:c270870bdd23 | 1189 | |
tobyspark | 15:4b394c64b461 | 1190 | ok = tvOne.setHDCPOn(false); |
tobyspark | 12:c270870bdd23 | 1191 | |
tobyspark | 12:c270870bdd23 | 1192 | std::string sendOK = ok ? "Sent: HDCP Off" : "Send Error: HDCP Off"; |
tobyspark | 12:c270870bdd23 | 1193 | |
tobyspark | 12:c270870bdd23 | 1194 | screen.clearBufferRow(kTVOneStatusLine); |
tobyspark | 12:c270870bdd23 | 1195 | screen.textToBuffer(sendOK, kTVOneStatusLine); |
tobyspark | 12:c270870bdd23 | 1196 | } |
tobyspark | 23:909928cafb95 | 1197 | else if (advancedMenu.selectedItem().payload.command[0] == advancedHDCPOn) |
tobyspark | 15:4b394c64b461 | 1198 | { |
tobyspark | 31:01845a2347ff | 1199 | bool ok; |
tobyspark | 15:4b394c64b461 | 1200 | |
tobyspark | 15:4b394c64b461 | 1201 | ok = tvOne.setHDCPOn(true); |
tobyspark | 15:4b394c64b461 | 1202 | |
tobyspark | 15:4b394c64b461 | 1203 | std::string sendOK = ok ? "Sent: HDCP On" : "Send Error: HDCP On"; |
tobyspark | 15:4b394c64b461 | 1204 | |
tobyspark | 15:4b394c64b461 | 1205 | screen.clearBufferRow(kTVOneStatusLine); |
tobyspark | 15:4b394c64b461 | 1206 | screen.textToBuffer(sendOK, kTVOneStatusLine); |
tobyspark | 15:4b394c64b461 | 1207 | } |
tobyspark | 31:01845a2347ff | 1208 | else if (advancedMenu.selectedItem().payload.command[0] == advancedEDIDPassthrough) |
tobyspark | 31:01845a2347ff | 1209 | { |
tobyspark | 31:01845a2347ff | 1210 | tvOneEDIDPassthrough = true; |
tobyspark | 31:01845a2347ff | 1211 | |
tobyspark | 31:01845a2347ff | 1212 | bool ok = true; |
tobyspark | 31:01845a2347ff | 1213 | |
tobyspark | 31:01845a2347ff | 1214 | int32_t slot = tvOneEDIDPassthrough ? EDIDPassthroughSlot : resolutionMenu.selectedItem().payload.command[1]; |
tobyspark | 31:01845a2347ff | 1215 | |
tobyspark | 31:01845a2347ff | 1216 | ok = ok && tvOne.command(kTV1SourceRGB1, kTV1WindowIDA, kTV1FunctionAdjustSourceEDID, slot); |
tobyspark | 31:01845a2347ff | 1217 | ok = ok && tvOne.command(kTV1SourceRGB2, kTV1WindowIDA, kTV1FunctionAdjustSourceEDID, slot); |
tobyspark | 31:01845a2347ff | 1218 | |
tobyspark | 31:01845a2347ff | 1219 | std::string sendOK = ok ? "Sent: EDID. Next:conform?" : "Send Error: EDID"; |
tobyspark | 31:01845a2347ff | 1220 | |
tobyspark | 31:01845a2347ff | 1221 | screen.clearBufferRow(kTVOneStatusLine); |
tobyspark | 31:01845a2347ff | 1222 | screen.textToBuffer(sendOK, kTVOneStatusLine); |
tobyspark | 31:01845a2347ff | 1223 | } |
tobyspark | 31:01845a2347ff | 1224 | else if (advancedMenu.selectedItem().payload.command[0] == advancedEDIDInternal) |
tobyspark | 31:01845a2347ff | 1225 | { |
tobyspark | 31:01845a2347ff | 1226 | tvOneEDIDPassthrough = false; |
tobyspark | 31:01845a2347ff | 1227 | |
tobyspark | 31:01845a2347ff | 1228 | bool ok = true; |
tobyspark | 31:01845a2347ff | 1229 | |
tobyspark | 31:01845a2347ff | 1230 | int32_t slot = tvOneEDIDPassthrough ? EDIDPassthroughSlot : resolutionMenu.selectedItem().payload.command[1]; |
tobyspark | 31:01845a2347ff | 1231 | |
tobyspark | 31:01845a2347ff | 1232 | ok = ok && tvOne.command(kTV1SourceRGB1, kTV1WindowIDA, kTV1FunctionAdjustSourceEDID, slot); |
tobyspark | 31:01845a2347ff | 1233 | ok = ok && tvOne.command(kTV1SourceRGB2, kTV1WindowIDA, kTV1FunctionAdjustSourceEDID, slot); |
tobyspark | 31:01845a2347ff | 1234 | |
tobyspark | 31:01845a2347ff | 1235 | std::string sendOK = ok ? "Sent: EDID. Next:conform?" : "Send Error: EDID"; |
tobyspark | 31:01845a2347ff | 1236 | |
tobyspark | 31:01845a2347ff | 1237 | screen.clearBufferRow(kTVOneStatusLine); |
tobyspark | 31:01845a2347ff | 1238 | screen.textToBuffer(sendOK, kTVOneStatusLine); |
tobyspark | 31:01845a2347ff | 1239 | } |
tobyspark | 30:873979018850 | 1240 | else if (advancedMenu.selectedItem().payload.command[0] == advancedTestSources) |
tobyspark | 34:69dfe64e7e6b | 1241 | { |
tobyspark | 34:69dfe64e7e6b | 1242 | tvOneRGB1Stable = false; |
tobyspark | 34:69dfe64e7e6b | 1243 | tvOneRGB2Stable = false; |
tobyspark | 34:69dfe64e7e6b | 1244 | handleTVOneSources(); |
tobyspark | 29:95a7efe30527 | 1245 | } |
tobyspark | 23:909928cafb95 | 1246 | else if (advancedMenu.selectedItem().payload.command[0] == advancedConformProcessor) |
tobyspark | 17:fc68d40b8b1f | 1247 | { |
tobyspark | 20:8b92d7922c48 | 1248 | screen.clearBufferRow(kTVOneStatusLine); |
tobyspark | 20:8b92d7922c48 | 1249 | screen.textToBuffer("Conforming...", kTVOneStatusLine); |
tobyspark | 20:8b92d7922c48 | 1250 | screen.sendBuffer(); |
tobyspark | 20:8b92d7922c48 | 1251 | |
tobyspark | 17:fc68d40b8b1f | 1252 | bool ok = conformProcessor(); |
tobyspark | 17:fc68d40b8b1f | 1253 | |
tobyspark | 17:fc68d40b8b1f | 1254 | std::string sendOK = ok ? "Conform success" : "Send Error: Conform"; |
tobyspark | 17:fc68d40b8b1f | 1255 | |
tobyspark | 17:fc68d40b8b1f | 1256 | screen.clearBufferRow(kTVOneStatusLine); |
tobyspark | 17:fc68d40b8b1f | 1257 | screen.textToBuffer(sendOK, kTVOneStatusLine); |
tobyspark | 17:fc68d40b8b1f | 1258 | } |
tobyspark | 23:909928cafb95 | 1259 | else if (advancedMenu.selectedItem().payload.command[0] == advancedLoadDefaults) |
tobyspark | 16:52484666b323 | 1260 | { |
tobyspark | 16:52484666b323 | 1261 | settings.loadDefaults(); |
tobyspark | 27:27851d3d2bba | 1262 | setMixModeMenuItems(); |
tobyspark | 27:27851d3d2bba | 1263 | setResolutionMenuItems(); |
tobyspark | 16:52484666b323 | 1264 | |
tobyspark | 16:52484666b323 | 1265 | screen.clearBufferRow(kTVOneStatusLine); |
tobyspark | 16:52484666b323 | 1266 | screen.textToBuffer("Controller reverted", kTVOneStatusLine); |
tobyspark | 16:52484666b323 | 1267 | } |
tobyspark | 23:909928cafb95 | 1268 | else if (advancedMenu.selectedItem().payload.command[0] == advancedSetResolutions) |
tobyspark | 21:f9d63cb7cedb | 1269 | { |
tobyspark | 21:f9d63cb7cedb | 1270 | bool ok; |
tobyspark | 21:f9d63cb7cedb | 1271 | ok = tvOne.setCustomResolutions(); |
tobyspark | 21:f9d63cb7cedb | 1272 | |
tobyspark | 21:f9d63cb7cedb | 1273 | screen.clearBufferRow(kTVOneStatusLine); |
tobyspark | 21:f9d63cb7cedb | 1274 | screen.textToBuffer(ok ? "Resolutions set" : "Res' could not be set", kTVOneStatusLine); |
tobyspark | 21:f9d63cb7cedb | 1275 | } |
tobyspark | 12:c270870bdd23 | 1276 | } |
tobyspark | 0:87aab40d5806 | 1277 | else |
tobyspark | 0:87aab40d5806 | 1278 | { |
tobyspark | 0:87aab40d5806 | 1279 | if (debug) { debug->printf("Warning: No action identified"); } |
tobyspark | 0:87aab40d5806 | 1280 | } |
tobyspark | 0:87aab40d5806 | 1281 | } |
tobyspark | 0:87aab40d5806 | 1282 | |
tobyspark | 34:69dfe64e7e6b | 1283 | // Send any updates to the display |
tobyspark | 34:69dfe64e7e6b | 1284 | screen.sendBuffer(); |
tobyspark | 0:87aab40d5806 | 1285 | |
tobyspark | 5:f8b285ca41ba | 1286 | //// MIX MIX MIX MIX MIX MIX MIX MIX MIX MIX MIX MIXMIX MIX MIXMIX MIX MIX MIX MIX MIXMIX MIX MIX |
tobyspark | 0:87aab40d5806 | 1287 | |
tobyspark | 0:87aab40d5806 | 1288 | bool updateFade = false; |
tobyspark | 3:033d2b7768f3 | 1289 | float xFade = 0; |
tobyspark | 3:033d2b7768f3 | 1290 | float fadeUp = 1; |
tobyspark | 3:033d2b7768f3 | 1291 | |
tobyspark | 3:033d2b7768f3 | 1292 | //// TASK: Process control surface |
tobyspark | 3:033d2b7768f3 | 1293 | |
tobyspark | 0:87aab40d5806 | 1294 | // Get new states of tap buttons, remembering at end of loop() assign these current values to the previous variables |
tobyspark | 5:f8b285ca41ba | 1295 | const bool tapLeft = !tapLeftDIN; |
tobyspark | 5:f8b285ca41ba | 1296 | const bool tapRight = !tapRightDIN; |
tobyspark | 0:87aab40d5806 | 1297 | |
tobyspark | 17:fc68d40b8b1f | 1298 | // We're taking a further median of the AINs on top of mbed libs v29. |
tobyspark | 17:fc68d40b8b1f | 1299 | // This takes some values from last passes and most from now. With debug off, seem to need median size > 5 |
tobyspark | 17:fc68d40b8b1f | 1300 | xFadeFilter.process(xFadeAIN.read()); |
tobyspark | 17:fc68d40b8b1f | 1301 | fadeUpFilter.process(fadeUpAIN.read()); |
tobyspark | 17:fc68d40b8b1f | 1302 | xFadeFilter.process(xFadeAIN.read()); |
tobyspark | 17:fc68d40b8b1f | 1303 | fadeUpFilter.process(fadeUpAIN.read()); |
tobyspark | 17:fc68d40b8b1f | 1304 | xFadeFilter.process(xFadeAIN.read()); |
tobyspark | 17:fc68d40b8b1f | 1305 | fadeUpFilter.process(fadeUpAIN.read()); |
tobyspark | 17:fc68d40b8b1f | 1306 | xFadeFilter.process(xFadeAIN.read()); |
tobyspark | 17:fc68d40b8b1f | 1307 | fadeUpFilter.process(fadeUpAIN.read()); |
tobyspark | 17:fc68d40b8b1f | 1308 | const float xFadeAINCached = xFadeFilter.process(xFadeAIN.read()); |
tobyspark | 17:fc68d40b8b1f | 1309 | const float fadeUpAINCached = fadeUpFilter.process(fadeUpAIN.read()); |
tobyspark | 0:87aab40d5806 | 1310 | |
tobyspark | 0:87aab40d5806 | 1311 | // When a tap is depressed, we can ignore any move of the crossfader but not fade to black |
tobyspark | 0:87aab40d5806 | 1312 | if (tapLeft || tapRight) |
tobyspark | 0:87aab40d5806 | 1313 | { |
tobyspark | 5:f8b285ca41ba | 1314 | // If both are pressed, take to the one that is new, ie. not the first pressed. |
tobyspark | 0:87aab40d5806 | 1315 | if (tapLeft && tapRight) |
tobyspark | 0:87aab40d5806 | 1316 | { |
tobyspark | 5:f8b285ca41ba | 1317 | xFade = tapLeftWasFirstPressed ? 1 : 0; |
tobyspark | 0:87aab40d5806 | 1318 | } |
tobyspark | 5:f8b285ca41ba | 1319 | // If just one is pressed, take to that and remember which is pressed |
tobyspark | 5:f8b285ca41ba | 1320 | else if (tapLeft) |
tobyspark | 5:f8b285ca41ba | 1321 | { |
tobyspark | 5:f8b285ca41ba | 1322 | xFade = 0; |
tobyspark | 5:f8b285ca41ba | 1323 | tapLeftWasFirstPressed = 1; |
tobyspark | 5:f8b285ca41ba | 1324 | } |
tobyspark | 5:f8b285ca41ba | 1325 | else if (tapRight) |
tobyspark | 5:f8b285ca41ba | 1326 | { |
tobyspark | 5:f8b285ca41ba | 1327 | xFade = 1; |
tobyspark | 5:f8b285ca41ba | 1328 | tapLeftWasFirstPressed = 0; |
tobyspark | 5:f8b285ca41ba | 1329 | } |
tobyspark | 5:f8b285ca41ba | 1330 | } |
tobyspark | 18:ebe5da639a6a | 1331 | else xFade = 1.0 - fadeCalc(xFadeAINCached, xFadeTolerance); |
tobyspark | 0:87aab40d5806 | 1332 | |
tobyspark | 0:87aab40d5806 | 1333 | fadeUp = 1.0 - fadeCalc(fadeUpAINCached, fadeUpTolerance); |
tobyspark | 0:87aab40d5806 | 1334 | |
tobyspark | 33:e6672a9bd571 | 1335 | //// TASK: Process Network Comms In, ie. modify TVOne state |
tobyspark | 5:f8b285ca41ba | 1336 | if (commsMode == commsOSC) |
tobyspark | 3:033d2b7768f3 | 1337 | { |
tobyspark | 3:033d2b7768f3 | 1338 | if (osc->newMessage) |
tobyspark | 3:033d2b7768f3 | 1339 | { |
tobyspark | 3:033d2b7768f3 | 1340 | osc->newMessage = false; // fixme! |
tobyspark | 33:e6672a9bd571 | 1341 | processOSCIn(xFade, fadeUp); |
tobyspark | 3:033d2b7768f3 | 1342 | } |
tobyspark | 3:033d2b7768f3 | 1343 | } |
tobyspark | 3:033d2b7768f3 | 1344 | |
tobyspark | 5:f8b285ca41ba | 1345 | if (commsMode == commsArtNet) |
tobyspark | 3:033d2b7768f3 | 1346 | { |
tobyspark | 33:e6672a9bd571 | 1347 | if (artNet->Work()) processArtNetIn(xFade, fadeUp); |
tobyspark | 3:033d2b7768f3 | 1348 | } |
tobyspark | 3:033d2b7768f3 | 1349 | |
tobyspark | 5:f8b285ca41ba | 1350 | if (commsMode == commsDMXIn) |
tobyspark | 5:f8b285ca41ba | 1351 | { |
tobyspark | 5:f8b285ca41ba | 1352 | processDMXIn(xFade, fadeUp); |
tobyspark | 5:f8b285ca41ba | 1353 | } |
tobyspark | 5:f8b285ca41ba | 1354 | |
tobyspark | 5:f8b285ca41ba | 1355 | if (commsMode == commsDMXOut) |
tobyspark | 5:f8b285ca41ba | 1356 | { |
tobyspark | 5:f8b285ca41ba | 1357 | processDMXOut(xFade, fadeUp); |
tobyspark | 5:f8b285ca41ba | 1358 | } |
tobyspark | 0:87aab40d5806 | 1359 | |
tobyspark | 0:87aab40d5806 | 1360 | // Calculate new A&B fade percents |
tobyspark | 0:87aab40d5806 | 1361 | int newFadeAPercent = 0; |
tobyspark | 0:87aab40d5806 | 1362 | int newFadeBPercent = 0; |
tobyspark | 0:87aab40d5806 | 1363 | |
tobyspark | 30:873979018850 | 1364 | if (mixMode == mixBlend) |
tobyspark | 11:0783cfbeb746 | 1365 | { |
tobyspark | 30:873979018850 | 1366 | if (fadeUp < 1.0) |
tobyspark | 30:873979018850 | 1367 | { |
tobyspark | 30:873979018850 | 1368 | // we need to set fade level of both windows as there is no way AFAIK to implement fade to black as a further window on top of A&B |
tobyspark | 30:873979018850 | 1369 | newFadeAPercent = (1.0-xFade) * fadeUp * 100.0; |
tobyspark | 30:873979018850 | 1370 | newFadeBPercent = xFade * fadeUp * 100.0; |
tobyspark | 30:873979018850 | 1371 | } |
tobyspark | 30:873979018850 | 1372 | else |
tobyspark | 30:873979018850 | 1373 | { |
tobyspark | 30:873979018850 | 1374 | // we can optimise and just fade A in and out over a fully up B, doubling the rate of fadeA commands sent. |
tobyspark | 30:873979018850 | 1375 | newFadeAPercent = (1.0-xFade) * 100.0; |
tobyspark | 30:873979018850 | 1376 | newFadeBPercent = 100.0; |
tobyspark | 30:873979018850 | 1377 | } |
tobyspark | 11:0783cfbeb746 | 1378 | } |
tobyspark | 15:4b394c64b461 | 1379 | else if (mixMode == mixAdditive) |
tobyspark | 11:0783cfbeb746 | 1380 | { |
tobyspark | 22:90054fe6d86c | 1381 | // we need to set fade level of both windows according to the fade curve profile |
tobyspark | 22:90054fe6d86c | 1382 | float newFadeA = (1.0-xFade) * (1.0 + fadeCurve); |
tobyspark | 22:90054fe6d86c | 1383 | float newFadeB = xFade * (1 + fadeCurve); |
tobyspark | 22:90054fe6d86c | 1384 | if (newFadeA > 1.0) newFadeA = 1.0; |
tobyspark | 22:90054fe6d86c | 1385 | if (newFadeB > 1.0) newFadeB = 1.0; |
tobyspark | 22:90054fe6d86c | 1386 | |
tobyspark | 22:90054fe6d86c | 1387 | newFadeAPercent = newFadeA * fadeUp * 100.0; |
tobyspark | 22:90054fe6d86c | 1388 | newFadeBPercent = newFadeB * fadeUp * 100.0; |
tobyspark | 11:0783cfbeb746 | 1389 | } |
tobyspark | 36:8b5c75c8bc23 | 1390 | else if (mixMode >= mixKeyStartIndex) |
tobyspark | 11:0783cfbeb746 | 1391 | { |
tobyspark | 0:87aab40d5806 | 1392 | newFadeAPercent = (1.0-xFade) * fadeUp * 100.0; |
tobyspark | 0:87aab40d5806 | 1393 | newFadeBPercent = fadeUp * 100.0; |
tobyspark | 0:87aab40d5806 | 1394 | } |
tobyspark | 0:87aab40d5806 | 1395 | |
tobyspark | 17:fc68d40b8b1f | 1396 | //// TASK: Send to TVOne if percents have changed |
tobyspark | 17:fc68d40b8b1f | 1397 | |
tobyspark | 17:fc68d40b8b1f | 1398 | // No amount of median filtering is stopping flipflopping between two adjacent percents, so... |
tobyspark | 17:fc68d40b8b1f | 1399 | bool fadeAPercentHasChanged; |
tobyspark | 17:fc68d40b8b1f | 1400 | bool fadeBPercentHasChanged; |
tobyspark | 17:fc68d40b8b1f | 1401 | if (oldFadeAPercent == newFadeAPercent && (newFadeAPercent == fadeAPercent - 1 || newFadeAPercent == fadeAPercent + 1)) |
tobyspark | 17:fc68d40b8b1f | 1402 | fadeAPercentHasChanged = false; |
tobyspark | 17:fc68d40b8b1f | 1403 | else |
tobyspark | 17:fc68d40b8b1f | 1404 | fadeAPercentHasChanged = newFadeAPercent != fadeAPercent; |
tobyspark | 17:fc68d40b8b1f | 1405 | if (oldFadeBPercent == newFadeBPercent && (newFadeBPercent == fadeBPercent - 1 || newFadeBPercent == fadeBPercent + 1)) |
tobyspark | 17:fc68d40b8b1f | 1406 | fadeBPercentHasChanged = false; |
tobyspark | 17:fc68d40b8b1f | 1407 | else |
tobyspark | 17:fc68d40b8b1f | 1408 | fadeBPercentHasChanged = newFadeBPercent != fadeBPercent; |
tobyspark | 17:fc68d40b8b1f | 1409 | |
tobyspark | 35:d5d9f0838f99 | 1410 | // If changing mixMode from additive, we want to do this before updating fade values |
tobyspark | 35:d5d9f0838f99 | 1411 | if (updateMixMode && mixMode != mixAdditive) actionMixMode(); |
tobyspark | 35:d5d9f0838f99 | 1412 | |
tobyspark | 9:f83eadd8917a | 1413 | // We want to send the higher first, otherwise black flashes can happen on taps |
tobyspark | 17:fc68d40b8b1f | 1414 | if (fadeAPercentHasChanged && newFadeAPercent >= newFadeBPercent) |
tobyspark | 8:d46cc49f0f37 | 1415 | { |
tobyspark | 17:fc68d40b8b1f | 1416 | oldFadeAPercent = fadeAPercent; |
tobyspark | 0:87aab40d5806 | 1417 | fadeAPercent = newFadeAPercent; |
tobyspark | 0:87aab40d5806 | 1418 | updateFade = true; |
tobyspark | 0:87aab40d5806 | 1419 | |
tobyspark | 0:87aab40d5806 | 1420 | fadeAPO = fadeAPercent / 100.0; |
tobyspark | 0:87aab40d5806 | 1421 | tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustWindowsMaxFadeLevel, fadeAPercent); |
tobyspark | 0:87aab40d5806 | 1422 | } |
tobyspark | 17:fc68d40b8b1f | 1423 | if (fadeBPercentHasChanged) |
tobyspark | 8:d46cc49f0f37 | 1424 | { |
tobyspark | 17:fc68d40b8b1f | 1425 | oldFadeBPercent = fadeBPercent; |
tobyspark | 0:87aab40d5806 | 1426 | fadeBPercent = newFadeBPercent; |
tobyspark | 0:87aab40d5806 | 1427 | updateFade = true; |
tobyspark | 0:87aab40d5806 | 1428 | |
tobyspark | 0:87aab40d5806 | 1429 | fadeBPO = fadeBPercent / 100.0; |
tobyspark | 0:87aab40d5806 | 1430 | tvOne.command(0, kTV1WindowIDB, kTV1FunctionAdjustWindowsMaxFadeLevel, fadeBPercent); |
tobyspark | 0:87aab40d5806 | 1431 | } |
tobyspark | 17:fc68d40b8b1f | 1432 | if (fadeAPercentHasChanged && newFadeAPercent < newFadeBPercent) |
tobyspark | 9:f83eadd8917a | 1433 | { |
tobyspark | 17:fc68d40b8b1f | 1434 | oldFadeAPercent = fadeAPercent; |
tobyspark | 9:f83eadd8917a | 1435 | fadeAPercent = newFadeAPercent; |
tobyspark | 9:f83eadd8917a | 1436 | updateFade = true; |
tobyspark | 9:f83eadd8917a | 1437 | |
tobyspark | 9:f83eadd8917a | 1438 | fadeAPO = fadeAPercent / 100.0; |
tobyspark | 9:f83eadd8917a | 1439 | tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustWindowsMaxFadeLevel, fadeAPercent); |
tobyspark | 9:f83eadd8917a | 1440 | } |
tobyspark | 8:d46cc49f0f37 | 1441 | if (updateFade && debug) |
tobyspark | 8:d46cc49f0f37 | 1442 | { |
tobyspark | 0:87aab40d5806 | 1443 | //debug->printf("xFade = %3f fadeUp = %3f \r\n", xFadeAIN.read(), fadeUpAIN.read()); |
tobyspark | 0:87aab40d5806 | 1444 | debug->printf("xFade = %3f fadeUp = %3f \r\n", xFadeAINCached, fadeUpAINCached); |
tobyspark | 0:87aab40d5806 | 1445 | debug->printf("xFade = %3f fadeUp = %3f fadeA% = %i fadeB% = %i \r\n", xFade, fadeUp, fadeAPercent, fadeBPercent); |
tobyspark | 18:ebe5da639a6a | 1446 | debug->printf("\r\n"); |
tobyspark | 0:87aab40d5806 | 1447 | } |
tobyspark | 30:873979018850 | 1448 | |
tobyspark | 35:d5d9f0838f99 | 1449 | // If changing mixMode to additive, we want to do this before updating fade values |
tobyspark | 35:d5d9f0838f99 | 1450 | if (updateMixMode && mixMode == mixAdditive) actionMixMode(); |
tobyspark | 35:d5d9f0838f99 | 1451 | |
tobyspark | 33:e6672a9bd571 | 1452 | //// TASK: Process Network Comms Out, ie. send out any fade updates |
tobyspark | 33:e6672a9bd571 | 1453 | if (commsMode == commsOSC && updateFade) |
tobyspark | 33:e6672a9bd571 | 1454 | { |
tobyspark | 33:e6672a9bd571 | 1455 | processOSCOut(xFade, fadeUp); |
tobyspark | 33:e6672a9bd571 | 1456 | } |
tobyspark | 33:e6672a9bd571 | 1457 | |
tobyspark | 33:e6672a9bd571 | 1458 | if (commsMode == commsArtNet && updateFade) |
tobyspark | 33:e6672a9bd571 | 1459 | { |
tobyspark | 33:e6672a9bd571 | 1460 | processArtNetOut(xFade, fadeUp); |
tobyspark | 33:e6672a9bd571 | 1461 | } |
tobyspark | 33:e6672a9bd571 | 1462 | |
tobyspark | 33:e6672a9bd571 | 1463 | if (commsMode == commsDMXOut && updateFade) |
tobyspark | 33:e6672a9bd571 | 1464 | { |
tobyspark | 33:e6672a9bd571 | 1465 | processDMXOut(xFade, fadeUp); |
tobyspark | 33:e6672a9bd571 | 1466 | } |
tobyspark | 33:e6672a9bd571 | 1467 | |
tobyspark | 34:69dfe64e7e6b | 1468 | // Housekeeping |
tobyspark | 34:69dfe64e7e6b | 1469 | if (tvOne.millisSinceLastCommandSent() > 1500) |
tobyspark | 30:873979018850 | 1470 | { |
tobyspark | 34:69dfe64e7e6b | 1471 | // We should check up on any source that hasn't ever been stable |
tobyspark | 30:873979018850 | 1472 | if (!tvOneRGB1Stable || !tvOneRGB2Stable) handleTVOneSources(); |
tobyspark | 30:873979018850 | 1473 | } |
tobyspark | 0:87aab40d5806 | 1474 | } |
tobyspark | 30:873979018850 | 1475 | } |