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@11:0783cfbeb746, 2012-08-27 (annotated)
- Committer:
- tobyspark
- Date:
- Mon Aug 27 15:10:23 2012 +0000
- Revision:
- 11:0783cfbeb746
- Parent:
- 10:c011b0e5c17e
- Child:
- 12:c270870bdd23
Settings abstracted out to a class, defaults being set and used.; Next step: implement SPKSettings::load()
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 | 8:d46cc49f0f37 | 38 | * vxx - TODO: Keying values load from USB mass storage |
tobyspark | 10:c011b0e5c17e | 39 | * vxx - TODO: Set keying values from controller, requires a guided, step-through process for user |
tobyspark | 8:d46cc49f0f37 | 40 | * vxx - TODO: Defaults load/save from USB mass storage |
tobyspark | 8:d46cc49f0f37 | 41 | * vxx - TODO: EDID upload from USB mass storage |
tobyspark | 8:d46cc49f0f37 | 42 | * vxx - TODO: EDID creation from resolution |
tobyspark | 8:d46cc49f0f37 | 43 | */ |
tobyspark | 8:d46cc49f0f37 | 44 | |
tobyspark | 0:87aab40d5806 | 45 | #include "mbed.h" |
tobyspark | 0:87aab40d5806 | 46 | |
tobyspark | 0:87aab40d5806 | 47 | #include "spk_tvone_mbed.h" |
tobyspark | 0:87aab40d5806 | 48 | #include "spk_utils.h" |
tobyspark | 0:87aab40d5806 | 49 | #include "spk_mRotaryEncoder.h" |
tobyspark | 0:87aab40d5806 | 50 | #include "spk_oled_ssd1305.h" |
tobyspark | 2:50043054e4f7 | 51 | #include "spk_oled_gfx.h" |
tobyspark | 11:0783cfbeb746 | 52 | #include "spk_settings.h" |
tobyspark | 1:f9fca21102e0 | 53 | #include "EthernetNetIf.h" |
tobyspark | 1:f9fca21102e0 | 54 | #include "mbedOSC.h" |
tobyspark | 3:033d2b7768f3 | 55 | #include "DmxArtNet.h" |
tobyspark | 5:f8b285ca41ba | 56 | #include "DMX.h" |
tobyspark | 0:87aab40d5806 | 57 | |
tobyspark | 0:87aab40d5806 | 58 | #include <sstream> |
tobyspark | 0:87aab40d5806 | 59 | |
tobyspark | 5:f8b285ca41ba | 60 | // MBED PINS |
tobyspark | 5:f8b285ca41ba | 61 | |
tobyspark | 5:f8b285ca41ba | 62 | #define kMBED_AIN_XFADE p20 |
tobyspark | 5:f8b285ca41ba | 63 | #define kMBED_AIN_FADEUP p19 |
tobyspark | 5:f8b285ca41ba | 64 | #define kMBED_DIN_TAP_L p24 |
tobyspark | 5:f8b285ca41ba | 65 | #define kMBED_DIN_TAP_R p23 |
tobyspark | 5:f8b285ca41ba | 66 | #define kMBED_ENC_SW p15 |
tobyspark | 5:f8b285ca41ba | 67 | #define kMBED_ENC_A p16 |
tobyspark | 5:f8b285ca41ba | 68 | #define kMBED_ENC_B p17 |
tobyspark | 5:f8b285ca41ba | 69 | |
tobyspark | 5:f8b285ca41ba | 70 | #define kMBED_RS232_TTLTX p13 |
tobyspark | 5:f8b285ca41ba | 71 | #define kMBED_RS232_TTLRX p14 |
tobyspark | 5:f8b285ca41ba | 72 | |
tobyspark | 5:f8b285ca41ba | 73 | #define kMBED_OLED_MOSI p5 |
tobyspark | 5:f8b285ca41ba | 74 | #define kMBED_OLED_SCK p7 |
tobyspark | 5:f8b285ca41ba | 75 | #define kMBED_OLED_CS p8 |
tobyspark | 5:f8b285ca41ba | 76 | #define kMBED_OLED_RES p9 |
tobyspark | 5:f8b285ca41ba | 77 | #define kMBED_OLED_DC p10 |
tobyspark | 5:f8b285ca41ba | 78 | |
tobyspark | 5:f8b285ca41ba | 79 | #define kMBED_DIN_ETHLO_DMXHI p30 |
tobyspark | 5:f8b285ca41ba | 80 | #define kMBED_DOUT_RS485_TXHI_RXLO p29 |
tobyspark | 5:f8b285ca41ba | 81 | #define kMBED_RS485_TTLTX p28 |
tobyspark | 5:f8b285ca41ba | 82 | #define kMBED_RS485_TTLRX p27 |
tobyspark | 5:f8b285ca41ba | 83 | |
tobyspark | 5:f8b285ca41ba | 84 | // DISPLAY |
tobyspark | 5:f8b285ca41ba | 85 | |
tobyspark | 1:f9fca21102e0 | 86 | #define kMenuLine1 3 |
tobyspark | 1:f9fca21102e0 | 87 | #define kMenuLine2 4 |
tobyspark | 1:f9fca21102e0 | 88 | #define kCommsStatusLine 6 |
tobyspark | 1:f9fca21102e0 | 89 | #define kTVOneStatusLine 7 |
tobyspark | 1:f9fca21102e0 | 90 | |
tobyspark | 5:f8b285ca41ba | 91 | // NETWORKING |
tobyspark | 5:f8b285ca41ba | 92 | |
tobyspark | 1:f9fca21102e0 | 93 | #define kOSCMbedPort 10000 |
tobyspark | 1:f9fca21102e0 | 94 | #define kOSCMbedIPAddress 10,0,0,2 |
tobyspark | 1:f9fca21102e0 | 95 | #define kOSCMbedSubnetMask 255,255,255,0 |
tobyspark | 1:f9fca21102e0 | 96 | #define kOSCMbedGateway 10,0,0,1 |
tobyspark | 1:f9fca21102e0 | 97 | #define kOSCMbedDNS 10,0,0,1 |
tobyspark | 0:87aab40d5806 | 98 | |
tobyspark | 3:033d2b7768f3 | 99 | #define kArtNetBindIPAddress 2,0,0,100 |
tobyspark | 3:033d2b7768f3 | 100 | #define kArtNetBroadcastAddress 2,255,255,255 |
tobyspark | 3:033d2b7768f3 | 101 | |
tobyspark | 5:f8b285ca41ba | 102 | #define kDMXInChannelXFade 0 |
tobyspark | 5:f8b285ca41ba | 103 | #define kDMXInChannelFadeUp 1 |
tobyspark | 5:f8b285ca41ba | 104 | #define kDMXOutChannelXFade 0 |
tobyspark | 5:f8b285ca41ba | 105 | #define kDMXOutChannelFadeUp 1 |
tobyspark | 5:f8b285ca41ba | 106 | |
tobyspark | 11:0783cfbeb746 | 107 | #define kSPKDFSettingsFilename "SPKDF-Settings.txt" |
tobyspark | 11:0783cfbeb746 | 108 | |
tobyspark | 0:87aab40d5806 | 109 | //// DEBUG |
tobyspark | 0:87aab40d5806 | 110 | |
tobyspark | 0:87aab40d5806 | 111 | // Comment out one or the other... |
tobyspark | 5:f8b285ca41ba | 112 | //Serial *debug = new Serial(USBTX, USBRX); // For debugging via USB serial |
tobyspark | 5:f8b285ca41ba | 113 | Serial *debug = NULL; // For release (no debugging) |
tobyspark | 0:87aab40d5806 | 114 | |
tobyspark | 0:87aab40d5806 | 115 | //// mBED PIN ASSIGNMENTS |
tobyspark | 0:87aab40d5806 | 116 | |
tobyspark | 0:87aab40d5806 | 117 | // Inputs |
tobyspark | 5:f8b285ca41ba | 118 | AnalogIn xFadeAIN(kMBED_AIN_XFADE); |
tobyspark | 5:f8b285ca41ba | 119 | AnalogIn fadeUpAIN(kMBED_AIN_FADEUP); |
tobyspark | 5:f8b285ca41ba | 120 | DigitalIn tapLeftDIN(kMBED_DIN_TAP_L); |
tobyspark | 5:f8b285ca41ba | 121 | DigitalIn tapRightDIN(kMBED_DIN_TAP_R); |
tobyspark | 0:87aab40d5806 | 122 | |
tobyspark | 5:f8b285ca41ba | 123 | SPKRotaryEncoder menuEnc(kMBED_ENC_A, kMBED_ENC_B, kMBED_ENC_SW); |
tobyspark | 5:f8b285ca41ba | 124 | |
tobyspark | 5:f8b285ca41ba | 125 | DigitalIn rj45ModeDIN(kMBED_DIN_ETHLO_DMXHI); |
tobyspark | 0:87aab40d5806 | 126 | |
tobyspark | 0:87aab40d5806 | 127 | // Outputs |
tobyspark | 0:87aab40d5806 | 128 | PwmOut fadeAPO(LED1); |
tobyspark | 0:87aab40d5806 | 129 | PwmOut fadeBPO(LED2); |
tobyspark | 0:87aab40d5806 | 130 | |
tobyspark | 5:f8b285ca41ba | 131 | DigitalOut dmxDirectionDOUT(kMBED_DOUT_RS485_TXHI_RXLO); |
tobyspark | 5:f8b285ca41ba | 132 | |
tobyspark | 0:87aab40d5806 | 133 | // SPKTVOne(PinName txPin, PinName rxPin, PinName signWritePin, PinName signErrorPin, Serial *debugSerial) |
tobyspark | 5:f8b285ca41ba | 134 | SPKTVOne tvOne(kMBED_RS232_TTLTX, kMBED_RS232_TTLRX, LED3, LED4, debug); |
tobyspark | 0:87aab40d5806 | 135 | |
tobyspark | 0:87aab40d5806 | 136 | // SPKDisplay(PinName mosi, PinName clk, PinName cs, PinName dc, PinName res, Serial *debugSerial = NULL); |
tobyspark | 5:f8b285ca41ba | 137 | SPKDisplay screen(kMBED_OLED_MOSI, kMBED_OLED_SCK, kMBED_OLED_CS, kMBED_OLED_DC, kMBED_OLED_RES, debug); |
tobyspark | 0:87aab40d5806 | 138 | |
tobyspark | 11:0783cfbeb746 | 139 | // Saved Settings |
tobyspark | 11:0783cfbeb746 | 140 | SPKSettings settings; |
tobyspark | 11:0783cfbeb746 | 141 | |
tobyspark | 0:87aab40d5806 | 142 | // Menu |
tobyspark | 0:87aab40d5806 | 143 | SPKMenu *selectedMenu; |
tobyspark | 0:87aab40d5806 | 144 | SPKMenu *lastSelectedMenu; |
tobyspark | 0:87aab40d5806 | 145 | SPKMenuOfMenus mainMenu; |
tobyspark | 0:87aab40d5806 | 146 | SPKMenuPayload resolutionMenu; |
tobyspark | 0:87aab40d5806 | 147 | SPKMenuPayload mixModeMenu; |
tobyspark | 11:0783cfbeb746 | 148 | enum { blend, additive, key }; // additive will require custom TVOne firmware. |
tobyspark | 5:f8b285ca41ba | 149 | int mixMode = blend; |
tobyspark | 1:f9fca21102e0 | 150 | SPKMenuPayload commsMenu; |
tobyspark | 5:f8b285ca41ba | 151 | enum { commsNone, commsOSC, commsArtNet, commsDMXIn, commsDMXOut}; |
tobyspark | 5:f8b285ca41ba | 152 | int commsMode = commsNone; |
tobyspark | 1:f9fca21102e0 | 153 | |
tobyspark | 5:f8b285ca41ba | 154 | // RJ45 Comms |
tobyspark | 5:f8b285ca41ba | 155 | enum { rj45Ethernet = 0, rj45DMX = 1}; // These values from circuit |
tobyspark | 5:f8b285ca41ba | 156 | int rj45Mode = -1; |
tobyspark | 1:f9fca21102e0 | 157 | EthernetNetIf *ethernet = NULL; |
tobyspark | 1:f9fca21102e0 | 158 | OSCClass *osc = NULL; |
tobyspark | 3:033d2b7768f3 | 159 | OSCMessage recMessage; |
tobyspark | 3:033d2b7768f3 | 160 | DmxArtNet *artNet = NULL; |
tobyspark | 5:f8b285ca41ba | 161 | DMX *dmx = NULL; |
tobyspark | 0:87aab40d5806 | 162 | |
tobyspark | 3:033d2b7768f3 | 163 | // Fade logic constants |
tobyspark | 0:87aab40d5806 | 164 | const float xFadeTolerance = 0.05; |
tobyspark | 0:87aab40d5806 | 165 | const float fadeUpTolerance = 0.05; |
tobyspark | 0:87aab40d5806 | 166 | |
tobyspark | 0:87aab40d5806 | 167 | // A&B Fade as resolved percent |
tobyspark | 0:87aab40d5806 | 168 | int fadeAPercent = 0; |
tobyspark | 0:87aab40d5806 | 169 | int fadeBPercent = 0; |
tobyspark | 0:87aab40d5806 | 170 | |
tobyspark | 0:87aab40d5806 | 171 | // Tap button states |
tobyspark | 5:f8b285ca41ba | 172 | bool tapLeftWasFirstPressed = false; |
tobyspark | 0:87aab40d5806 | 173 | |
tobyspark | 0:87aab40d5806 | 174 | // Key mode parameters |
tobyspark | 0:87aab40d5806 | 175 | int keyerParamsSet = -1; // last keyParams index uploaded to unit |
tobyspark | 0:87aab40d5806 | 176 | |
tobyspark | 3:033d2b7768f3 | 177 | void processOSC(float &xFade, float &fadeUp) { |
tobyspark | 3:033d2b7768f3 | 178 | std::stringstream statusMessage; |
tobyspark | 3:033d2b7768f3 | 179 | statusMessage.setf(ios::fixed,ios::floatfield); |
tobyspark | 3:033d2b7768f3 | 180 | statusMessage.precision(2); |
tobyspark | 3:033d2b7768f3 | 181 | |
tobyspark | 3:033d2b7768f3 | 182 | if (!strcmp( recMessage.getTopAddress() , "dvimxr" )) |
tobyspark | 3:033d2b7768f3 | 183 | { |
tobyspark | 3:033d2b7768f3 | 184 | statusMessage << "OSC: /dvimxr"; |
tobyspark | 3:033d2b7768f3 | 185 | if (!strcmp( recMessage.getSubAddress() , "xFade" )) |
tobyspark | 3:033d2b7768f3 | 186 | if (recMessage.getArgNum() == 1) |
tobyspark | 3:033d2b7768f3 | 187 | if (recMessage.getTypeTag(0) == 'f') |
tobyspark | 3:033d2b7768f3 | 188 | { |
tobyspark | 3:033d2b7768f3 | 189 | double newXFade = recMessage.getArgFloat(0); |
tobyspark | 3:033d2b7768f3 | 190 | statusMessage << "/xFade " << newXFade; |
tobyspark | 3:033d2b7768f3 | 191 | xFade = newXFade; |
tobyspark | 3:033d2b7768f3 | 192 | } |
tobyspark | 3:033d2b7768f3 | 193 | else if (!strcmp( recMessage.getSubAddress() , "fadeUp" )) |
tobyspark | 3:033d2b7768f3 | 194 | if (recMessage.getArgNum() == 1) |
tobyspark | 3:033d2b7768f3 | 195 | if (recMessage.getTypeTag(0) == 'f') |
tobyspark | 3:033d2b7768f3 | 196 | { |
tobyspark | 3:033d2b7768f3 | 197 | double newFadeUp = recMessage.getArgFloat(0); |
tobyspark | 3:033d2b7768f3 | 198 | statusMessage << "/fadeUp " << newFadeUp; |
tobyspark | 3:033d2b7768f3 | 199 | xFade = newFadeUp; |
tobyspark | 3:033d2b7768f3 | 200 | } |
tobyspark | 3:033d2b7768f3 | 201 | else statusMessage << recMessage.getSubAddress() << " - Ignoring"; |
tobyspark | 3:033d2b7768f3 | 202 | } |
tobyspark | 3:033d2b7768f3 | 203 | else |
tobyspark | 3:033d2b7768f3 | 204 | { |
tobyspark | 3:033d2b7768f3 | 205 | statusMessage << "OSC: " << recMessage.getTopAddress() << " - Ignoring"; |
tobyspark | 3:033d2b7768f3 | 206 | } |
tobyspark | 3:033d2b7768f3 | 207 | |
tobyspark | 3:033d2b7768f3 | 208 | screen.clearBufferRow(kCommsStatusLine); |
tobyspark | 3:033d2b7768f3 | 209 | screen.textToBuffer(statusMessage.str(), kCommsStatusLine); |
tobyspark | 3:033d2b7768f3 | 210 | screen.sendBuffer(); |
tobyspark | 3:033d2b7768f3 | 211 | if (debug) debug->printf("%s \r\n", statusMessage.str().c_str()); |
tobyspark | 3:033d2b7768f3 | 212 | |
tobyspark | 3:033d2b7768f3 | 213 | } |
tobyspark | 3:033d2b7768f3 | 214 | |
tobyspark | 8:d46cc49f0f37 | 215 | void processArtNet(float &xFade, float &fadeUp) |
tobyspark | 8:d46cc49f0f37 | 216 | { |
tobyspark | 3:033d2b7768f3 | 217 | screen.clearBufferRow(kCommsStatusLine); |
tobyspark | 3:033d2b7768f3 | 218 | screen.textToBuffer("ArtNet activity", kCommsStatusLine); |
tobyspark | 3:033d2b7768f3 | 219 | screen.sendBuffer(); |
tobyspark | 3:033d2b7768f3 | 220 | if (debug) debug->printf("ArtNet activity"); |
tobyspark | 3:033d2b7768f3 | 221 | } |
tobyspark | 0:87aab40d5806 | 222 | |
tobyspark | 8:d46cc49f0f37 | 223 | void processDMXIn(float &xFade, float &fadeUp) |
tobyspark | 8:d46cc49f0f37 | 224 | { |
tobyspark | 5:f8b285ca41ba | 225 | std::stringstream statusMessage; |
tobyspark | 5:f8b285ca41ba | 226 | |
tobyspark | 5:f8b285ca41ba | 227 | int xFadeDMX = dmx->get(kDMXInChannelXFade); |
tobyspark | 7:e6717468c18d | 228 | int fadeUpDMX = dmx->get(kDMXInChannelFadeUp); |
tobyspark | 5:f8b285ca41ba | 229 | |
tobyspark | 5:f8b285ca41ba | 230 | xFade = (float)xFadeDMX/255; |
tobyspark | 5:f8b285ca41ba | 231 | fadeUp = (float)fadeUpDMX/255; |
tobyspark | 5:f8b285ca41ba | 232 | |
tobyspark | 5:f8b285ca41ba | 233 | screen.clearBufferRow(kCommsStatusLine); |
tobyspark | 5:f8b285ca41ba | 234 | statusMessage << "DMX In: xF " << xFadeDMX << " fUp " << fadeUpDMX; |
tobyspark | 5:f8b285ca41ba | 235 | screen.textToBuffer(statusMessage.str(), kCommsStatusLine); |
tobyspark | 5:f8b285ca41ba | 236 | screen.sendBuffer(); |
tobyspark | 5:f8b285ca41ba | 237 | if (debug) debug->printf(statusMessage.str().c_str()); |
tobyspark | 5:f8b285ca41ba | 238 | } |
tobyspark | 5:f8b285ca41ba | 239 | |
tobyspark | 8:d46cc49f0f37 | 240 | void processDMXOut(float &xFade, float &fadeUp) |
tobyspark | 8:d46cc49f0f37 | 241 | { |
tobyspark | 5:f8b285ca41ba | 242 | std::stringstream statusMessage; |
tobyspark | 5:f8b285ca41ba | 243 | |
tobyspark | 5:f8b285ca41ba | 244 | int xFadeDMX = xFade*255; |
tobyspark | 5:f8b285ca41ba | 245 | int fadeUpDMX = fadeUp*255; |
tobyspark | 5:f8b285ca41ba | 246 | |
tobyspark | 5:f8b285ca41ba | 247 | dmx->put(kDMXOutChannelXFade, xFadeDMX); |
tobyspark | 5:f8b285ca41ba | 248 | dmx->put(kDMXOutChannelFadeUp, fadeUpDMX); |
tobyspark | 5:f8b285ca41ba | 249 | |
tobyspark | 5:f8b285ca41ba | 250 | screen.clearBufferRow(kCommsStatusLine); |
tobyspark | 5:f8b285ca41ba | 251 | statusMessage << "DMX Out: xF " << xFadeDMX << " fUp " << fadeUpDMX; |
tobyspark | 5:f8b285ca41ba | 252 | screen.textToBuffer(statusMessage.str(), kCommsStatusLine); |
tobyspark | 5:f8b285ca41ba | 253 | screen.sendBuffer(); |
tobyspark | 5:f8b285ca41ba | 254 | if (debug) debug->printf(statusMessage.str().c_str()); |
tobyspark | 5:f8b285ca41ba | 255 | } |
tobyspark | 0:87aab40d5806 | 256 | |
tobyspark | 8:d46cc49f0f37 | 257 | inline float fadeCalc (const float AIN, const float tolerance) |
tobyspark | 8:d46cc49f0f37 | 258 | { |
tobyspark | 0:87aab40d5806 | 259 | float pos ; |
tobyspark | 0:87aab40d5806 | 260 | if (AIN < tolerance) pos = 0; |
tobyspark | 0:87aab40d5806 | 261 | else if (AIN > 1.0 - tolerance) pos = 1; |
tobyspark | 0:87aab40d5806 | 262 | else pos = (AIN - tolerance) / (1 - 2*tolerance); |
tobyspark | 0:87aab40d5806 | 263 | if (debug && false) debug->printf("fadeCalc in: %f out: %f \r\n", AIN, pos); |
tobyspark | 0:87aab40d5806 | 264 | return pos; |
tobyspark | 0:87aab40d5806 | 265 | } |
tobyspark | 0:87aab40d5806 | 266 | |
tobyspark | 8:d46cc49f0f37 | 267 | bool setKeyParamsTo(int index) |
tobyspark | 8:d46cc49f0f37 | 268 | { |
tobyspark | 0:87aab40d5806 | 269 | // Only spend the time uploading six parameters if we need to |
tobyspark | 0:87aab40d5806 | 270 | // Might want to bounds check here |
tobyspark | 0:87aab40d5806 | 271 | |
tobyspark | 9:f83eadd8917a | 272 | bool ok; |
tobyspark | 0:87aab40d5806 | 273 | |
tobyspark | 0:87aab40d5806 | 274 | if (index != keyerParamsSet) |
tobyspark | 0:87aab40d5806 | 275 | { |
tobyspark | 11:0783cfbeb746 | 276 | ok = tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerMinY, settings.keyerParamSet(index)[0]); |
tobyspark | 11:0783cfbeb746 | 277 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerMaxY, settings.keyerParamSet(index)[1]); |
tobyspark | 11:0783cfbeb746 | 278 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerMinU, settings.keyerParamSet(index)[2]); |
tobyspark | 11:0783cfbeb746 | 279 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerMaxU, settings.keyerParamSet(index)[3]); |
tobyspark | 11:0783cfbeb746 | 280 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerMinV, settings.keyerParamSet(index)[4]); |
tobyspark | 11:0783cfbeb746 | 281 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerMaxV, settings.keyerParamSet(index)[5]); |
tobyspark | 0:87aab40d5806 | 282 | |
tobyspark | 0:87aab40d5806 | 283 | keyerParamsSet = index; |
tobyspark | 9:f83eadd8917a | 284 | } |
tobyspark | 9:f83eadd8917a | 285 | else |
tobyspark | 9:f83eadd8917a | 286 | { |
tobyspark | 9:f83eadd8917a | 287 | ok = true; |
tobyspark | 9:f83eadd8917a | 288 | } |
tobyspark | 0:87aab40d5806 | 289 | |
tobyspark | 0:87aab40d5806 | 290 | return ok; |
tobyspark | 0:87aab40d5806 | 291 | } |
tobyspark | 0:87aab40d5806 | 292 | |
tobyspark | 0:87aab40d5806 | 293 | int main() |
tobyspark | 0:87aab40d5806 | 294 | { |
tobyspark | 0:87aab40d5806 | 295 | if (debug) |
tobyspark | 0:87aab40d5806 | 296 | { |
tobyspark | 0:87aab40d5806 | 297 | debug->printf("\r\n\r\n"); |
tobyspark | 0:87aab40d5806 | 298 | debug->printf("*spark d-fuser -----------\r\n"); |
tobyspark | 0:87aab40d5806 | 299 | debug->printf(" debug channel\r\n"); |
tobyspark | 0:87aab40d5806 | 300 | } |
tobyspark | 2:50043054e4f7 | 301 | |
tobyspark | 2:50043054e4f7 | 302 | // Set display font |
tobyspark | 2:50043054e4f7 | 303 | screen.fontStartCharacter = &characterBytesStartChar; |
tobyspark | 2:50043054e4f7 | 304 | screen.fontEndCharacter = &characterBytesEndChar; |
tobyspark | 2:50043054e4f7 | 305 | screen.fontCharacters = characterBytes; |
tobyspark | 2:50043054e4f7 | 306 | |
tobyspark | 0:87aab40d5806 | 307 | // Splash screen |
tobyspark | 2:50043054e4f7 | 308 | screen.imageToBuffer(spkDisplayLogo); |
tobyspark | 0:87aab40d5806 | 309 | screen.textToBuffer("SPK:D-Fuser",0); |
tobyspark | 5:f8b285ca41ba | 310 | screen.textToBuffer("SW beta.18",1); |
tobyspark | 5:f8b285ca41ba | 311 | screen.sendBuffer(); |
tobyspark | 0:87aab40d5806 | 312 | |
tobyspark | 11:0783cfbeb746 | 313 | // Load saved settings |
tobyspark | 11:0783cfbeb746 | 314 | settings.load(kSPKDFSettingsFilename); |
tobyspark | 11:0783cfbeb746 | 315 | |
tobyspark | 0:87aab40d5806 | 316 | // Set menu structure |
tobyspark | 0:87aab40d5806 | 317 | mixModeMenu.title = "Mix Mode"; |
tobyspark | 0:87aab40d5806 | 318 | mixModeMenu.addMenuItem("Blend", blend, 0); |
tobyspark | 11:0783cfbeb746 | 319 | for (int i=0; i < settings.keyerSetCount(); i++) |
tobyspark | 11:0783cfbeb746 | 320 | { |
tobyspark | 11:0783cfbeb746 | 321 | mixModeMenu.addMenuItem(settings.keyerParamName(i), key+i, 0); |
tobyspark | 11:0783cfbeb746 | 322 | } |
tobyspark | 0:87aab40d5806 | 323 | |
tobyspark | 0:87aab40d5806 | 324 | resolutionMenu.title = "Resolution"; |
tobyspark | 0:87aab40d5806 | 325 | resolutionMenu.addMenuItem(kTV1ResolutionDescriptionVGA, kTV1ResolutionVGA, 5); |
tobyspark | 0:87aab40d5806 | 326 | resolutionMenu.addMenuItem(kTV1ResolutionDescriptionSVGA, kTV1ResolutionSVGA, 5); |
tobyspark | 0:87aab40d5806 | 327 | resolutionMenu.addMenuItem(kTV1ResolutionDescriptionXGAp60, kTV1ResolutionXGAp60, 5); |
tobyspark | 0:87aab40d5806 | 328 | resolutionMenu.addMenuItem(kTV1ResolutionDescriptionWSXGAPLUSp60, kTV1ResolutionWSXGAPLUSp60, 5); |
tobyspark | 0:87aab40d5806 | 329 | resolutionMenu.addMenuItem(kTV1ResolutionDescriptionWUXGAp60, kTV1ResolutionWUXGAp60, 5); |
tobyspark | 0:87aab40d5806 | 330 | resolutionMenu.addMenuItem(kTV1ResolutionDescription720p60, kTV1Resolution720p60, 5); |
tobyspark | 0:87aab40d5806 | 331 | resolutionMenu.addMenuItem(kTV1ResolutionDescription1080p60, kTV1Resolution1080p60, 5); |
tobyspark | 0:87aab40d5806 | 332 | resolutionMenu.addMenuItem(kTV1ResolutionDescriptionDualHeadSVGAp60, kTV1ResolutionDualHeadSVGAp60, 0); |
tobyspark | 0:87aab40d5806 | 333 | resolutionMenu.addMenuItem(kTV1ResolutionDescriptionDualHeadXGAp60, kTV1ResolutionDualHeadXGAp60, 0); |
tobyspark | 0:87aab40d5806 | 334 | resolutionMenu.addMenuItem(kTV1ResolutionDescriptionTripleHeadVGAp60, kTV1ResolutionTripleHeadVGAp60, 0); |
tobyspark | 0:87aab40d5806 | 335 | |
tobyspark | 5:f8b285ca41ba | 336 | commsMenu.title = "Network Mode"; |
tobyspark | 1:f9fca21102e0 | 337 | commsMenu.addMenuItem("None", commsNone, 0); |
tobyspark | 1:f9fca21102e0 | 338 | commsMenu.addMenuItem("OSC", commsOSC, 0); |
tobyspark | 1:f9fca21102e0 | 339 | commsMenu.addMenuItem("ArtNet", commsArtNet, 0); |
tobyspark | 5:f8b285ca41ba | 340 | commsMenu.addMenuItem("DMX In", commsDMXIn, 0); |
tobyspark | 5:f8b285ca41ba | 341 | commsMenu.addMenuItem("DMX Out", commsDMXOut, 0); |
tobyspark | 1:f9fca21102e0 | 342 | |
tobyspark | 0:87aab40d5806 | 343 | mainMenu.title = "Main Menu"; |
tobyspark | 0:87aab40d5806 | 344 | mainMenu.addMenuItem(&mixModeMenu); |
tobyspark | 0:87aab40d5806 | 345 | mainMenu.addMenuItem(&resolutionMenu); |
tobyspark | 1:f9fca21102e0 | 346 | mainMenu.addMenuItem(&commsMenu); |
tobyspark | 0:87aab40d5806 | 347 | |
tobyspark | 0:87aab40d5806 | 348 | selectedMenu = &mainMenu; |
tobyspark | 0:87aab40d5806 | 349 | lastSelectedMenu = &mainMenu; |
tobyspark | 0:87aab40d5806 | 350 | |
tobyspark | 0:87aab40d5806 | 351 | // Misc I/O stuff |
tobyspark | 0:87aab40d5806 | 352 | |
tobyspark | 0:87aab40d5806 | 353 | fadeAPO.period(0.001); |
tobyspark | 0:87aab40d5806 | 354 | fadeBPO.period(0.001); |
tobyspark | 0:87aab40d5806 | 355 | |
tobyspark | 0:87aab40d5806 | 356 | // TVOne setup |
tobyspark | 0:87aab40d5806 | 357 | |
tobyspark | 9:f83eadd8917a | 358 | bool ok = true; |
tobyspark | 0:87aab40d5806 | 359 | |
tobyspark | 0:87aab40d5806 | 360 | // horrid, horrid HDCP |
tobyspark | 0:87aab40d5806 | 361 | ok = tvOne.setHDCPOff(); |
tobyspark | 0:87aab40d5806 | 362 | |
tobyspark | 0:87aab40d5806 | 363 | std::string sendOK = ok ? "Sent: HDCP Off" : "Send Error: HDCP Off"; |
tobyspark | 0:87aab40d5806 | 364 | |
tobyspark | 0:87aab40d5806 | 365 | // display menu and framing lines |
tobyspark | 0:87aab40d5806 | 366 | screen.horizLineToBuffer(kMenuLine1*pixInPage - 1); |
tobyspark | 0:87aab40d5806 | 367 | screen.clearBufferRow(kMenuLine1); |
tobyspark | 0:87aab40d5806 | 368 | screen.textToBuffer(selectedMenu->title, kMenuLine1); |
tobyspark | 0:87aab40d5806 | 369 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 0:87aab40d5806 | 370 | screen.textToBuffer(selectedMenu->selectedString(), kMenuLine2); |
tobyspark | 0:87aab40d5806 | 371 | screen.horizLineToBuffer(kMenuLine2*pixInPage + pixInPage); |
tobyspark | 1:f9fca21102e0 | 372 | screen.horizLineToBuffer(kCommsStatusLine*pixInPage - 1); |
tobyspark | 1:f9fca21102e0 | 373 | screen.clearBufferRow(kCommsStatusLine); |
tobyspark | 1:f9fca21102e0 | 374 | screen.textToBuffer(commsMenu.selectedString(), kCommsStatusLine); |
tobyspark | 1:f9fca21102e0 | 375 | screen.clearBufferRow(kTVOneStatusLine); |
tobyspark | 1:f9fca21102e0 | 376 | screen.textToBuffer(sendOK, kTVOneStatusLine); |
tobyspark | 0:87aab40d5806 | 377 | screen.sendBuffer(); |
tobyspark | 0:87aab40d5806 | 378 | |
tobyspark | 0:87aab40d5806 | 379 | |
tobyspark | 0:87aab40d5806 | 380 | //// CONTROLS TEST |
tobyspark | 0:87aab40d5806 | 381 | |
tobyspark | 0:87aab40d5806 | 382 | while (0) { |
tobyspark | 0:87aab40d5806 | 383 | 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 | 384 | } |
tobyspark | 0:87aab40d5806 | 385 | |
tobyspark | 0:87aab40d5806 | 386 | //// MIXER RUN |
tobyspark | 0:87aab40d5806 | 387 | |
tobyspark | 8:d46cc49f0f37 | 388 | while (1) |
tobyspark | 8:d46cc49f0f37 | 389 | { |
tobyspark | 1:f9fca21102e0 | 390 | //// Task background things |
tobyspark | 5:f8b285ca41ba | 391 | if (ethernet && rj45Mode == rj45Ethernet) |
tobyspark | 5:f8b285ca41ba | 392 | { |
tobyspark | 5:f8b285ca41ba | 393 | if (debug) debug->printf("net poll"); |
tobyspark | 5:f8b285ca41ba | 394 | Net::poll(); |
tobyspark | 5:f8b285ca41ba | 395 | } |
tobyspark | 5:f8b285ca41ba | 396 | |
tobyspark | 5:f8b285ca41ba | 397 | //// RJ45 SWITCH |
tobyspark | 5:f8b285ca41ba | 398 | |
tobyspark | 5:f8b285ca41ba | 399 | if (rj45ModeDIN != rj45Mode) |
tobyspark | 1:f9fca21102e0 | 400 | { |
tobyspark | 5:f8b285ca41ba | 401 | // update state |
tobyspark | 5:f8b285ca41ba | 402 | rj45Mode = rj45ModeDIN; |
tobyspark | 5:f8b285ca41ba | 403 | if (rj45Mode == rj45Ethernet) commsMenu.title = "Network Mode [Ethernet]"; |
tobyspark | 5:f8b285ca41ba | 404 | if (rj45Mode == rj45DMX) commsMenu.title = "Network Mode [DMX]"; |
tobyspark | 5:f8b285ca41ba | 405 | |
tobyspark | 5:f8b285ca41ba | 406 | // cancel old comms |
tobyspark | 5:f8b285ca41ba | 407 | commsMode = commsNone; |
tobyspark | 5:f8b285ca41ba | 408 | commsMenu = commsMode; |
tobyspark | 5:f8b285ca41ba | 409 | |
tobyspark | 5:f8b285ca41ba | 410 | // refresh display |
tobyspark | 5:f8b285ca41ba | 411 | if (selectedMenu == &commsMenu) screen.textToBuffer(selectedMenu->title, kMenuLine1); |
tobyspark | 5:f8b285ca41ba | 412 | if (rj45Mode == rj45Ethernet) screen.textToBuffer("RJ45: Ethernet Engaged", kCommsStatusLine); |
tobyspark | 5:f8b285ca41ba | 413 | if (rj45Mode == rj45DMX) screen.textToBuffer("RJ45: DMX Engaged", kCommsStatusLine); |
tobyspark | 1:f9fca21102e0 | 414 | } |
tobyspark | 1:f9fca21102e0 | 415 | |
tobyspark | 0:87aab40d5806 | 416 | //// MENU |
tobyspark | 0:87aab40d5806 | 417 | |
tobyspark | 0:87aab40d5806 | 418 | int menuChange = menuEnc.getChange(); |
tobyspark | 0:87aab40d5806 | 419 | |
tobyspark | 0:87aab40d5806 | 420 | // Update GUI |
tobyspark | 0:87aab40d5806 | 421 | if (menuChange != 0) |
tobyspark | 0:87aab40d5806 | 422 | { |
tobyspark | 0:87aab40d5806 | 423 | if (debug) debug->printf("Menu changed by %i\r\n", menuChange); |
tobyspark | 0:87aab40d5806 | 424 | |
tobyspark | 0:87aab40d5806 | 425 | *selectedMenu = selectedMenu->selectedIndex() + menuChange; |
tobyspark | 0:87aab40d5806 | 426 | |
tobyspark | 0:87aab40d5806 | 427 | // update OLED line 2 here |
tobyspark | 0:87aab40d5806 | 428 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 0:87aab40d5806 | 429 | screen.textToBuffer(selectedMenu->selectedString(), kMenuLine2); |
tobyspark | 0:87aab40d5806 | 430 | |
tobyspark | 0:87aab40d5806 | 431 | if (debug) debug->printf("%s \r\n", selectedMenu->selectedString().c_str()); |
tobyspark | 0:87aab40d5806 | 432 | } |
tobyspark | 0:87aab40d5806 | 433 | |
tobyspark | 0:87aab40d5806 | 434 | // Action menu item |
tobyspark | 0:87aab40d5806 | 435 | if (menuEnc.hasPressed()) |
tobyspark | 0:87aab40d5806 | 436 | { |
tobyspark | 0:87aab40d5806 | 437 | if (debug) debug->printf("Action Menu Item!\r\n"); |
tobyspark | 0:87aab40d5806 | 438 | |
tobyspark | 0:87aab40d5806 | 439 | // Are we changing menus? |
tobyspark | 0:87aab40d5806 | 440 | if (selectedMenu->type() == menuOfMenus) |
tobyspark | 0:87aab40d5806 | 441 | { |
tobyspark | 0:87aab40d5806 | 442 | // point selected menu to the new menu |
tobyspark | 0:87aab40d5806 | 443 | // FIXME. Make this function abstract virtual of base class or get dynamic_cast working. BTW: C++ sucks / Obj-c rocks / Right now. |
tobyspark | 0:87aab40d5806 | 444 | if (selectedMenu == &mainMenu) selectedMenu = mainMenu.selectedMenu(); |
tobyspark | 0:87aab40d5806 | 445 | else if (debug) debug->printf("FIXME: You've missed a SPKMenuOfMenus"); |
tobyspark | 0:87aab40d5806 | 446 | |
tobyspark | 0:87aab40d5806 | 447 | // reset the selection within that menu to the first position |
tobyspark | 0:87aab40d5806 | 448 | (*selectedMenu) = 0; |
tobyspark | 0:87aab40d5806 | 449 | |
tobyspark | 0:87aab40d5806 | 450 | // update OLED lines 1&2 |
tobyspark | 0:87aab40d5806 | 451 | screen.clearBufferRow(kMenuLine1); |
tobyspark | 0:87aab40d5806 | 452 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 0:87aab40d5806 | 453 | screen.textToBuffer(selectedMenu->title, kMenuLine1); |
tobyspark | 0:87aab40d5806 | 454 | screen.textToBuffer(selectedMenu->selectedString(), kMenuLine2); |
tobyspark | 0:87aab40d5806 | 455 | |
tobyspark | 0:87aab40d5806 | 456 | if (debug) |
tobyspark | 0:87aab40d5806 | 457 | { |
tobyspark | 0:87aab40d5806 | 458 | debug->printf("\r\n"); |
tobyspark | 0:87aab40d5806 | 459 | debug->printf("%s \r\n", selectedMenu->title.c_str()); |
tobyspark | 0:87aab40d5806 | 460 | debug->printf("%s \r\n", selectedMenu->selectedString().c_str()); |
tobyspark | 0:87aab40d5806 | 461 | } |
tobyspark | 0:87aab40d5806 | 462 | } |
tobyspark | 0:87aab40d5806 | 463 | // Are we cancelling? |
tobyspark | 0:87aab40d5806 | 464 | else if (selectedMenu->type() == payload && selectedMenu->selectedIndex() == 0) |
tobyspark | 0:87aab40d5806 | 465 | { |
tobyspark | 0:87aab40d5806 | 466 | selectedMenu = lastSelectedMenu; |
tobyspark | 0:87aab40d5806 | 467 | |
tobyspark | 0:87aab40d5806 | 468 | // update OLED lines 1&2 |
tobyspark | 0:87aab40d5806 | 469 | screen.clearBufferRow(kMenuLine1); |
tobyspark | 0:87aab40d5806 | 470 | screen.clearBufferRow(kMenuLine2); |
tobyspark | 0:87aab40d5806 | 471 | screen.textToBuffer(selectedMenu->title, kMenuLine1); |
tobyspark | 0:87aab40d5806 | 472 | screen.textToBuffer(selectedMenu->selectedString(), kMenuLine2); |
tobyspark | 0:87aab40d5806 | 473 | |
tobyspark | 0:87aab40d5806 | 474 | if (debug) |
tobyspark | 0:87aab40d5806 | 475 | { |
tobyspark | 0:87aab40d5806 | 476 | debug->printf("\r\n"); |
tobyspark | 0:87aab40d5806 | 477 | debug->printf("%s \r\n", selectedMenu->title.c_str()); |
tobyspark | 0:87aab40d5806 | 478 | debug->printf("%s \r\n", selectedMenu->selectedString().c_str()); |
tobyspark | 0:87aab40d5806 | 479 | } |
tobyspark | 0:87aab40d5806 | 480 | } |
tobyspark | 0:87aab40d5806 | 481 | // With that out of the way, we should be actioning a specific menu's payload? |
tobyspark | 0:87aab40d5806 | 482 | else if (selectedMenu == &mixModeMenu) |
tobyspark | 0:87aab40d5806 | 483 | { |
tobyspark | 5:f8b285ca41ba | 484 | mixMode = mixModeMenu.selectedPayload1(); |
tobyspark | 5:f8b285ca41ba | 485 | |
tobyspark | 9:f83eadd8917a | 486 | bool ok = true; |
tobyspark | 0:87aab40d5806 | 487 | std::string sentOK; |
tobyspark | 0:87aab40d5806 | 488 | std::stringstream sentMSG; |
tobyspark | 0:87aab40d5806 | 489 | |
tobyspark | 11:0783cfbeb746 | 490 | // Set Keyer |
tobyspark | 11:0783cfbeb746 | 491 | if (mixModeMenu.selectedPayload1() < key) |
tobyspark | 11:0783cfbeb746 | 492 | { |
tobyspark | 11:0783cfbeb746 | 493 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerEnable, false); |
tobyspark | 11:0783cfbeb746 | 494 | sentMSG << "Keyer Off"; |
tobyspark | 11:0783cfbeb746 | 495 | } |
tobyspark | 11:0783cfbeb746 | 496 | else |
tobyspark | 11:0783cfbeb746 | 497 | { |
tobyspark | 11:0783cfbeb746 | 498 | ok = ok && tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustKeyerEnable, true); |
tobyspark | 11:0783cfbeb746 | 499 | sentMSG << "Keyer On"; |
tobyspark | 11:0783cfbeb746 | 500 | |
tobyspark | 11:0783cfbeb746 | 501 | int index = mixModeMenu.selectedPayload1() - key; |
tobyspark | 11:0783cfbeb746 | 502 | ok = ok && setKeyParamsTo(index); |
tobyspark | 11:0783cfbeb746 | 503 | sentMSG << " with " << index; |
tobyspark | 0:87aab40d5806 | 504 | } |
tobyspark | 0:87aab40d5806 | 505 | |
tobyspark | 0:87aab40d5806 | 506 | if (ok) sentOK = "Sent:"; |
tobyspark | 0:87aab40d5806 | 507 | else sentOK = "Send Error:"; |
tobyspark | 0:87aab40d5806 | 508 | |
tobyspark | 1:f9fca21102e0 | 509 | screen.clearBufferRow(kTVOneStatusLine); |
tobyspark | 1:f9fca21102e0 | 510 | screen.textToBuffer(sentOK + sentMSG.str(), kTVOneStatusLine); |
tobyspark | 0:87aab40d5806 | 511 | |
tobyspark | 0:87aab40d5806 | 512 | if (debug) { debug->printf("Changing mix mode"); } |
tobyspark | 0:87aab40d5806 | 513 | } |
tobyspark | 0:87aab40d5806 | 514 | else if (selectedMenu == &resolutionMenu) |
tobyspark | 0:87aab40d5806 | 515 | { |
tobyspark | 9:f83eadd8917a | 516 | bool ok = true; |
tobyspark | 0:87aab40d5806 | 517 | |
tobyspark | 0:87aab40d5806 | 518 | ok = tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustOutputsOutputResolution, resolutionMenu.selectedPayload1()); |
tobyspark | 0:87aab40d5806 | 519 | ok = ok && tvOne.command(kTV1SourceRGB1, kTV1WindowIDA, kTV1FunctionAdjustSourceEDID, resolutionMenu.selectedPayload2()); |
tobyspark | 0:87aab40d5806 | 520 | ok = ok && tvOne.command(kTV1SourceRGB2, kTV1WindowIDA, kTV1FunctionAdjustSourceEDID, resolutionMenu.selectedPayload2()); |
tobyspark | 0:87aab40d5806 | 521 | |
tobyspark | 0:87aab40d5806 | 522 | std::string sentOK; |
tobyspark | 0:87aab40d5806 | 523 | if (ok) sentOK = "Sent: "; |
tobyspark | 0:87aab40d5806 | 524 | else sentOK = "Send Error: "; |
tobyspark | 0:87aab40d5806 | 525 | |
tobyspark | 0:87aab40d5806 | 526 | std::stringstream sentMSG; |
tobyspark | 0:87aab40d5806 | 527 | sentMSG << "Res " << resolutionMenu.selectedPayload1() << ", EDID " << resolutionMenu.selectedPayload2(); |
tobyspark | 0:87aab40d5806 | 528 | |
tobyspark | 1:f9fca21102e0 | 529 | screen.clearBufferRow(kTVOneStatusLine); |
tobyspark | 1:f9fca21102e0 | 530 | screen.textToBuffer(sentOK + sentMSG.str(), kTVOneStatusLine); |
tobyspark | 0:87aab40d5806 | 531 | |
tobyspark | 0:87aab40d5806 | 532 | if (debug) { debug->printf("Changing resolution"); } |
tobyspark | 0:87aab40d5806 | 533 | } |
tobyspark | 1:f9fca21102e0 | 534 | else if (selectedMenu == &commsMenu) |
tobyspark | 1:f9fca21102e0 | 535 | { |
tobyspark | 5:f8b285ca41ba | 536 | std::string commsTypeString = "Network: --"; |
tobyspark | 1:f9fca21102e0 | 537 | std::stringstream commsStatus; |
tobyspark | 1:f9fca21102e0 | 538 | |
tobyspark | 1:f9fca21102e0 | 539 | // Tear down any existing comms |
tobyspark | 1:f9fca21102e0 | 540 | // This is the action of commsNone |
tobyspark | 1:f9fca21102e0 | 541 | // And also clears the way for other comms actions |
tobyspark | 5:f8b285ca41ba | 542 | if (osc) {delete osc; osc = NULL;} |
tobyspark | 5:f8b285ca41ba | 543 | if (ethernet) {delete ethernet; ethernet = NULL;} |
tobyspark | 5:f8b285ca41ba | 544 | if (artNet) {delete artNet; artNet = NULL;} |
tobyspark | 5:f8b285ca41ba | 545 | if (dmx) {delete dmx; dmx = NULL;} |
tobyspark | 5:f8b285ca41ba | 546 | |
tobyspark | 5:f8b285ca41ba | 547 | // Ensure we can't change to comms modes the hardware isn't switched to |
tobyspark | 5:f8b285ca41ba | 548 | if (rj45Mode == rj45DMX && (commsMenu.selectedPayload1() == commsOSC || commsMenu.selectedPayload1() == commsArtNet)) |
tobyspark | 1:f9fca21102e0 | 549 | { |
tobyspark | 5:f8b285ca41ba | 550 | commsTypeString = "RJ45 not in Ethernet mode"; |
tobyspark | 5:f8b285ca41ba | 551 | } |
tobyspark | 5:f8b285ca41ba | 552 | else if (rj45Mode == rj45Ethernet && (commsMenu.selectedPayload1() == commsDMXIn || commsMenu.selectedPayload1() == commsDMXOut)) |
tobyspark | 5:f8b285ca41ba | 553 | { |
tobyspark | 5:f8b285ca41ba | 554 | commsTypeString = "RJ45 not in DMX mode"; |
tobyspark | 5:f8b285ca41ba | 555 | } |
tobyspark | 5:f8b285ca41ba | 556 | // Action! |
tobyspark | 5:f8b285ca41ba | 557 | else if (commsMenu.selectedPayload1() == commsOSC) |
tobyspark | 5:f8b285ca41ba | 558 | { |
tobyspark | 5:f8b285ca41ba | 559 | commsMode = commsOSC; |
tobyspark | 5:f8b285ca41ba | 560 | commsTypeString = "OSC: "; |
tobyspark | 1:f9fca21102e0 | 561 | |
tobyspark | 1:f9fca21102e0 | 562 | ethernet = new EthernetNetIf( |
tobyspark | 1:f9fca21102e0 | 563 | IpAddr(kOSCMbedIPAddress), |
tobyspark | 1:f9fca21102e0 | 564 | IpAddr(kOSCMbedSubnetMask), |
tobyspark | 1:f9fca21102e0 | 565 | IpAddr(kOSCMbedGateway), |
tobyspark | 1:f9fca21102e0 | 566 | IpAddr(kOSCMbedDNS) |
tobyspark | 1:f9fca21102e0 | 567 | ); |
tobyspark | 3:033d2b7768f3 | 568 | |
tobyspark | 1:f9fca21102e0 | 569 | EthernetErr ethError = ethernet->setup(); |
tobyspark | 1:f9fca21102e0 | 570 | if(ethError) |
tobyspark | 1:f9fca21102e0 | 571 | { |
tobyspark | 1:f9fca21102e0 | 572 | if (debug) debug->printf("Ethernet setup error, %d", ethError); |
tobyspark | 1:f9fca21102e0 | 573 | commsStatus << "Ethernet setup failed"; |
tobyspark | 5:f8b285ca41ba | 574 | commsMenu = commsNone; |
tobyspark | 1:f9fca21102e0 | 575 | // break out of here. this setup should be a function that returns a boolean |
tobyspark | 1:f9fca21102e0 | 576 | } |
tobyspark | 1:f9fca21102e0 | 577 | |
tobyspark | 1:f9fca21102e0 | 578 | osc = new OSCClass(); |
tobyspark | 3:033d2b7768f3 | 579 | osc->setReceiveMessage(&recMessage); |
tobyspark | 1:f9fca21102e0 | 580 | osc->begin(kOSCMbedPort); |
tobyspark | 1:f9fca21102e0 | 581 | |
tobyspark | 3:033d2b7768f3 | 582 | commsStatus << "Listening on " << kOSCMbedPort; |
tobyspark | 1:f9fca21102e0 | 583 | } |
tobyspark | 1:f9fca21102e0 | 584 | else if (commsMenu.selectedPayload1() == commsArtNet) |
tobyspark | 1:f9fca21102e0 | 585 | { |
tobyspark | 5:f8b285ca41ba | 586 | commsMode = commsArtNet; |
tobyspark | 5:f8b285ca41ba | 587 | commsTypeString = "ArtNet: "; |
tobyspark | 3:033d2b7768f3 | 588 | |
tobyspark | 3:033d2b7768f3 | 589 | artNet = new DmxArtNet(); |
tobyspark | 1:f9fca21102e0 | 590 | |
tobyspark | 3:033d2b7768f3 | 591 | artNet->BindIpAddress = IpAddr(kArtNetBindIPAddress); |
tobyspark | 3:033d2b7768f3 | 592 | artNet->BCastAddress = IpAddr(kArtNetBroadcastAddress); |
tobyspark | 3:033d2b7768f3 | 593 | |
tobyspark | 3:033d2b7768f3 | 594 | artNet->InitArtPollReplyDefaults(); |
tobyspark | 3:033d2b7768f3 | 595 | |
tobyspark | 3:033d2b7768f3 | 596 | artNet->ArtPollReply.PortType[0] = 128; // output |
tobyspark | 3:033d2b7768f3 | 597 | artNet->ArtPollReply.PortType[2] = 64; // input |
tobyspark | 3:033d2b7768f3 | 598 | artNet->ArtPollReply.GoodInput[2] = 4; |
tobyspark | 3:033d2b7768f3 | 599 | |
tobyspark | 3:033d2b7768f3 | 600 | artNet->Init(); |
tobyspark | 3:033d2b7768f3 | 601 | artNet->SendArtPollReply(); // announce to art-net nodes |
tobyspark | 3:033d2b7768f3 | 602 | |
tobyspark | 3:033d2b7768f3 | 603 | commsStatus << "Listening"; |
tobyspark | 1:f9fca21102e0 | 604 | } |
tobyspark | 5:f8b285ca41ba | 605 | else if (commsMenu.selectedPayload1() == commsDMXIn) |
tobyspark | 1:f9fca21102e0 | 606 | { |
tobyspark | 5:f8b285ca41ba | 607 | commsMode = commsDMXIn; |
tobyspark | 5:f8b285ca41ba | 608 | commsTypeString = "DMX In: "; |
tobyspark | 1:f9fca21102e0 | 609 | |
tobyspark | 5:f8b285ca41ba | 610 | dmxDirectionDOUT = 0; |
tobyspark | 5:f8b285ca41ba | 611 | |
tobyspark | 5:f8b285ca41ba | 612 | dmx = new DMX(kMBED_RS485_TTLTX, kMBED_RS485_TTLRX); |
tobyspark | 1:f9fca21102e0 | 613 | } |
tobyspark | 5:f8b285ca41ba | 614 | else if (commsMenu.selectedPayload1() == commsDMXOut) |
tobyspark | 5:f8b285ca41ba | 615 | { |
tobyspark | 5:f8b285ca41ba | 616 | commsMode = commsDMXOut; |
tobyspark | 5:f8b285ca41ba | 617 | commsTypeString = "DMX Out: "; |
tobyspark | 5:f8b285ca41ba | 618 | |
tobyspark | 5:f8b285ca41ba | 619 | dmxDirectionDOUT = 1; |
tobyspark | 5:f8b285ca41ba | 620 | |
tobyspark | 5:f8b285ca41ba | 621 | dmx = new DMX(kMBED_RS485_TTLTX, kMBED_RS485_TTLRX); |
tobyspark | 5:f8b285ca41ba | 622 | } |
tobyspark | 5:f8b285ca41ba | 623 | |
tobyspark | 1:f9fca21102e0 | 624 | screen.clearBufferRow(kCommsStatusLine); |
tobyspark | 5:f8b285ca41ba | 625 | screen.textToBuffer(commsTypeString + commsStatus.str(), kCommsStatusLine); |
tobyspark | 1:f9fca21102e0 | 626 | } |
tobyspark | 0:87aab40d5806 | 627 | else |
tobyspark | 0:87aab40d5806 | 628 | { |
tobyspark | 0:87aab40d5806 | 629 | if (debug) { debug->printf("Warning: No action identified"); } |
tobyspark | 0:87aab40d5806 | 630 | } |
tobyspark | 0:87aab40d5806 | 631 | } |
tobyspark | 0:87aab40d5806 | 632 | |
tobyspark | 2:50043054e4f7 | 633 | // Send any updates to the display |
tobyspark | 2:50043054e4f7 | 634 | screen.sendBuffer(); |
tobyspark | 5:f8b285ca41ba | 635 | |
tobyspark | 0:87aab40d5806 | 636 | |
tobyspark | 5:f8b285ca41ba | 637 | //// MIX MIX MIX MIX MIX MIX MIX MIX MIX MIX MIX MIXMIX MIX MIXMIX MIX MIX MIX MIX MIXMIX MIX MIX |
tobyspark | 0:87aab40d5806 | 638 | |
tobyspark | 0:87aab40d5806 | 639 | bool updateFade = false; |
tobyspark | 3:033d2b7768f3 | 640 | float xFade = 0; |
tobyspark | 3:033d2b7768f3 | 641 | float fadeUp = 1; |
tobyspark | 3:033d2b7768f3 | 642 | |
tobyspark | 3:033d2b7768f3 | 643 | //// TASK: Process control surface |
tobyspark | 3:033d2b7768f3 | 644 | |
tobyspark | 0:87aab40d5806 | 645 | // Get new states of tap buttons, remembering at end of loop() assign these current values to the previous variables |
tobyspark | 5:f8b285ca41ba | 646 | const bool tapLeft = !tapLeftDIN; |
tobyspark | 5:f8b285ca41ba | 647 | const bool tapRight = !tapRightDIN; |
tobyspark | 0:87aab40d5806 | 648 | |
tobyspark | 0:87aab40d5806 | 649 | // We're going to cache the analog in reads, as have seen wierdness otherwise |
tobyspark | 5:f8b285ca41ba | 650 | const float xFadeAINCached = 1-xFadeAIN.read(); |
tobyspark | 0:87aab40d5806 | 651 | const float fadeUpAINCached = fadeUpAIN.read(); |
tobyspark | 0:87aab40d5806 | 652 | |
tobyspark | 0:87aab40d5806 | 653 | // When a tap is depressed, we can ignore any move of the crossfader but not fade to black |
tobyspark | 0:87aab40d5806 | 654 | if (tapLeft || tapRight) |
tobyspark | 0:87aab40d5806 | 655 | { |
tobyspark | 5:f8b285ca41ba | 656 | // If both are pressed, take to the one that is new, ie. not the first pressed. |
tobyspark | 0:87aab40d5806 | 657 | if (tapLeft && tapRight) |
tobyspark | 0:87aab40d5806 | 658 | { |
tobyspark | 5:f8b285ca41ba | 659 | xFade = tapLeftWasFirstPressed ? 1 : 0; |
tobyspark | 0:87aab40d5806 | 660 | } |
tobyspark | 5:f8b285ca41ba | 661 | // If just one is pressed, take to that and remember which is pressed |
tobyspark | 5:f8b285ca41ba | 662 | else if (tapLeft) |
tobyspark | 5:f8b285ca41ba | 663 | { |
tobyspark | 5:f8b285ca41ba | 664 | xFade = 0; |
tobyspark | 5:f8b285ca41ba | 665 | tapLeftWasFirstPressed = 1; |
tobyspark | 5:f8b285ca41ba | 666 | } |
tobyspark | 5:f8b285ca41ba | 667 | else if (tapRight) |
tobyspark | 5:f8b285ca41ba | 668 | { |
tobyspark | 5:f8b285ca41ba | 669 | xFade = 1; |
tobyspark | 5:f8b285ca41ba | 670 | tapLeftWasFirstPressed = 0; |
tobyspark | 5:f8b285ca41ba | 671 | } |
tobyspark | 5:f8b285ca41ba | 672 | } |
tobyspark | 0:87aab40d5806 | 673 | else xFade = fadeCalc(xFadeAINCached, xFadeTolerance); |
tobyspark | 0:87aab40d5806 | 674 | |
tobyspark | 0:87aab40d5806 | 675 | fadeUp = 1.0 - fadeCalc(fadeUpAINCached, fadeUpTolerance); |
tobyspark | 0:87aab40d5806 | 676 | |
tobyspark | 3:033d2b7768f3 | 677 | //// TASK: Process Network Comms |
tobyspark | 5:f8b285ca41ba | 678 | if (commsMode == commsOSC) |
tobyspark | 3:033d2b7768f3 | 679 | { |
tobyspark | 3:033d2b7768f3 | 680 | if (osc->newMessage) |
tobyspark | 3:033d2b7768f3 | 681 | { |
tobyspark | 3:033d2b7768f3 | 682 | osc->newMessage = false; // fixme! |
tobyspark | 3:033d2b7768f3 | 683 | processOSC(xFade, fadeUp); |
tobyspark | 3:033d2b7768f3 | 684 | } |
tobyspark | 3:033d2b7768f3 | 685 | } |
tobyspark | 3:033d2b7768f3 | 686 | |
tobyspark | 5:f8b285ca41ba | 687 | if (commsMode == commsArtNet) |
tobyspark | 3:033d2b7768f3 | 688 | { |
tobyspark | 3:033d2b7768f3 | 689 | if (artNet->Work()) processArtNet(xFade, fadeUp); |
tobyspark | 3:033d2b7768f3 | 690 | } |
tobyspark | 3:033d2b7768f3 | 691 | |
tobyspark | 5:f8b285ca41ba | 692 | if (commsMode == commsDMXIn) |
tobyspark | 5:f8b285ca41ba | 693 | { |
tobyspark | 5:f8b285ca41ba | 694 | processDMXIn(xFade, fadeUp); |
tobyspark | 5:f8b285ca41ba | 695 | } |
tobyspark | 5:f8b285ca41ba | 696 | |
tobyspark | 5:f8b285ca41ba | 697 | if (commsMode == commsDMXOut) |
tobyspark | 5:f8b285ca41ba | 698 | { |
tobyspark | 5:f8b285ca41ba | 699 | processDMXOut(xFade, fadeUp); |
tobyspark | 5:f8b285ca41ba | 700 | } |
tobyspark | 0:87aab40d5806 | 701 | |
tobyspark | 0:87aab40d5806 | 702 | // Calculate new A&B fade percents |
tobyspark | 0:87aab40d5806 | 703 | int newFadeAPercent = 0; |
tobyspark | 0:87aab40d5806 | 704 | int newFadeBPercent = 0; |
tobyspark | 0:87aab40d5806 | 705 | |
tobyspark | 11:0783cfbeb746 | 706 | if (mixMode == blend) |
tobyspark | 11:0783cfbeb746 | 707 | { |
tobyspark | 9:f83eadd8917a | 708 | if (fadeUp < 1.0) |
tobyspark | 9:f83eadd8917a | 709 | { |
tobyspark | 9:f83eadd8917a | 710 | // 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 | 9:f83eadd8917a | 711 | newFadeAPercent = (1.0-xFade) * fadeUp * 100.0; |
tobyspark | 9:f83eadd8917a | 712 | newFadeBPercent = xFade * fadeUp * 100.0; |
tobyspark | 9:f83eadd8917a | 713 | } |
tobyspark | 9:f83eadd8917a | 714 | else |
tobyspark | 9:f83eadd8917a | 715 | { |
tobyspark | 9:f83eadd8917a | 716 | // we can optimise and just fade A in and out over a fully up B, doubling the rate of fadeA commands sent. |
tobyspark | 9:f83eadd8917a | 717 | newFadeAPercent = (1.0-xFade) * 100.0; |
tobyspark | 9:f83eadd8917a | 718 | newFadeBPercent = 100.0; |
tobyspark | 9:f83eadd8917a | 719 | } |
tobyspark | 11:0783cfbeb746 | 720 | } |
tobyspark | 11:0783cfbeb746 | 721 | else if (mixMode == additive) |
tobyspark | 11:0783cfbeb746 | 722 | { |
tobyspark | 9:f83eadd8917a | 723 | // we need to set fade level of both windows according to the fade curve profile (yet to implement - to do when tvone supply additive capability) |
tobyspark | 0:87aab40d5806 | 724 | newFadeAPercent = (1.0-xFade) * fadeUp * 100.0; |
tobyspark | 0:87aab40d5806 | 725 | newFadeBPercent = xFade * fadeUp * 100.0; |
tobyspark | 11:0783cfbeb746 | 726 | } |
tobyspark | 11:0783cfbeb746 | 727 | else if (mixMode >= key) |
tobyspark | 11:0783cfbeb746 | 728 | { |
tobyspark | 0:87aab40d5806 | 729 | newFadeAPercent = (1.0-xFade) * fadeUp * 100.0; |
tobyspark | 0:87aab40d5806 | 730 | newFadeBPercent = fadeUp * 100.0; |
tobyspark | 0:87aab40d5806 | 731 | } |
tobyspark | 0:87aab40d5806 | 732 | |
tobyspark | 0:87aab40d5806 | 733 | // Send to TVOne if percents have changed |
tobyspark | 9:f83eadd8917a | 734 | // We want to send the higher first, otherwise black flashes can happen on taps |
tobyspark | 9:f83eadd8917a | 735 | if (newFadeAPercent != fadeAPercent && newFadeAPercent >= newFadeBPercent) |
tobyspark | 8:d46cc49f0f37 | 736 | { |
tobyspark | 0:87aab40d5806 | 737 | fadeAPercent = newFadeAPercent; |
tobyspark | 0:87aab40d5806 | 738 | updateFade = true; |
tobyspark | 0:87aab40d5806 | 739 | |
tobyspark | 0:87aab40d5806 | 740 | fadeAPO = fadeAPercent / 100.0; |
tobyspark | 0:87aab40d5806 | 741 | tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustWindowsMaxFadeLevel, fadeAPercent); |
tobyspark | 0:87aab40d5806 | 742 | } |
tobyspark | 0:87aab40d5806 | 743 | |
tobyspark | 8:d46cc49f0f37 | 744 | if (newFadeBPercent != fadeBPercent) |
tobyspark | 8:d46cc49f0f37 | 745 | { |
tobyspark | 0:87aab40d5806 | 746 | fadeBPercent = newFadeBPercent; |
tobyspark | 0:87aab40d5806 | 747 | updateFade = true; |
tobyspark | 0:87aab40d5806 | 748 | |
tobyspark | 0:87aab40d5806 | 749 | fadeBPO = fadeBPercent / 100.0; |
tobyspark | 0:87aab40d5806 | 750 | tvOne.command(0, kTV1WindowIDB, kTV1FunctionAdjustWindowsMaxFadeLevel, fadeBPercent); |
tobyspark | 0:87aab40d5806 | 751 | } |
tobyspark | 0:87aab40d5806 | 752 | |
tobyspark | 9:f83eadd8917a | 753 | if (newFadeAPercent != fadeAPercent && newFadeAPercent < newFadeBPercent) |
tobyspark | 9:f83eadd8917a | 754 | { |
tobyspark | 9:f83eadd8917a | 755 | fadeAPercent = newFadeAPercent; |
tobyspark | 9:f83eadd8917a | 756 | updateFade = true; |
tobyspark | 9:f83eadd8917a | 757 | |
tobyspark | 9:f83eadd8917a | 758 | fadeAPO = fadeAPercent / 100.0; |
tobyspark | 9:f83eadd8917a | 759 | tvOne.command(0, kTV1WindowIDA, kTV1FunctionAdjustWindowsMaxFadeLevel, fadeAPercent); |
tobyspark | 9:f83eadd8917a | 760 | } |
tobyspark | 9:f83eadd8917a | 761 | |
tobyspark | 8:d46cc49f0f37 | 762 | if (updateFade && debug) |
tobyspark | 8:d46cc49f0f37 | 763 | { |
tobyspark | 0:87aab40d5806 | 764 | debug->printf("\r\n"); |
tobyspark | 0:87aab40d5806 | 765 | //debug->printf("xFade = %3f fadeUp = %3f \r\n", xFadeAIN.read(), fadeUpAIN.read()); |
tobyspark | 0:87aab40d5806 | 766 | debug->printf("xFade = %3f fadeUp = %3f \r\n", xFadeAINCached, fadeUpAINCached); |
tobyspark | 0:87aab40d5806 | 767 | debug->printf("xFade = %3f fadeUp = %3f fadeA% = %i fadeB% = %i \r\n", xFade, fadeUp, fadeAPercent, fadeBPercent); |
tobyspark | 0:87aab40d5806 | 768 | } |
tobyspark | 5:f8b285ca41ba | 769 | |
tobyspark | 0:87aab40d5806 | 770 | } |
tobyspark | 0:87aab40d5806 | 771 | } |