#include #include #include "helpers.h" #include "open9xGruvin9xeeprom.h" #include #include extern void getEEPROMZString(char *dst, const char *src, int size); extern RawSwitch open9xStockToSwitch(int8_t sw); t_Open9xGruvin9xPhaseData_v207::operator PhaseData () { PhaseData c9x; for (int i=0; i> (2*i)) & 0x03); c9x.swtch = open9xStockToSwitch(swtch); getEEPROMZString(c9x.name, name, sizeof(name)); c9x.fadeIn = fadeIn; c9x.fadeOut = fadeOut; for (int i=0; i<2; i++) c9x.rotaryEncoders[i] = rotaryEncoders[i]; return c9x; } t_Open9xGruvin9xPhaseData_v208::operator PhaseData () { PhaseData c9x; for (int i=0; i= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) { c9x.val1 = open9xV4207ToSource(v1).toValue(); } if (c9x.func >= CS_FN_EQUAL) { c9x.val2 = open9xV4207ToSource(v2).toValue(); } if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) { c9x.val1 = open9xStockToSwitch(v1).toValue(); c9x.val2 = open9xStockToSwitch(v2).toValue(); } return c9x; } Open9xGruvin9xCustomSwData_v209::operator CustomSwData () { CustomSwData c9x; c9x.func = func; c9x.val1 = v1; c9x.val2 = v2; if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) { c9x.val1 = open9xV4209ToSource(v1).toValue(); } if (c9x.func >= CS_FN_EQUAL && c9x.func <= CS_FN_ELESS) { c9x.val2 = open9xV4209ToSource(v2).toValue(); } if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) { c9x.val1 = open9xStockToSwitch(v1).toValue(); c9x.val2 = open9xStockToSwitch(v2).toValue(); } return c9x; } t_Open9xGruvin9xFuncSwData_v203::operator FuncSwData () { FuncSwData c9x; c9x.swtch = open9xStockToSwitch(swtch); if (func < 16) { c9x.func = (AssignFunc)(func); c9x.enabled=param & 0x01; c9x.param = (param>>1)<<1; } else { c9x.param = param; if (func <= 20) c9x.func = (AssignFunc)(func); else if (func == 21) c9x.func = FuncInstantTrim; else if (func == 22) c9x.func = FuncPlaySound; else if (func == 23) c9x.func = FuncPlayHaptic; else if (func == 24) c9x.func = FuncReset; else if (func == 25) c9x.func = FuncVario; else if (func == 26) c9x.func = FuncPlayPrompt; else if (func == 27) c9x.func = FuncPlayValue; else if (func == 28) c9x.func = FuncLogs; else if (func == 29) c9x.func = FuncBacklight; else if (func >= 30 && func <= 34) c9x.func = AssignFunc(FuncAdjustGV1 + func - 30); else c9x.clear(); } return c9x; } t_Open9xGruvin9xFuncSwData_v210::operator FuncSwData () { FuncSwData c9x; c9x.swtch = open9xStockToSwitch(swtch); c9x.param = param; if (func < 22) { c9x.func = (AssignFunc)(func); c9x.enabled = delay; } else { if (func == 22) c9x.func = FuncPlaySound; else if (func == 23) c9x.func = FuncPlayHaptic; else if (func == 24) c9x.func = FuncReset; else if (func == 25) c9x.func = FuncVario; else if (func == 26) c9x.func = FuncPlayPrompt; else if (func == 27) c9x.func = FuncPlayValue; else if (func == 28) c9x.func = FuncLogs; else c9x.clear(); } return c9x; } t_Open9xGruvin9xSwashRingData_v208::operator SwashRingData () { SwashRingData c9x; c9x.invertELE = invertELE; c9x.invertAIL = invertAIL; c9x.invertCOL = invertCOL; c9x.type = type; c9x.collectiveSource = open9xV4207ToSource(collectiveSource); c9x.value = value; return c9x; } t_Open9xGruvin9xSwashRingData_v209::operator SwashRingData () { SwashRingData c9x; c9x.invertELE = invertELE; c9x.invertAIL = invertAIL; c9x.invertCOL = invertCOL; c9x.type = type; c9x.collectiveSource = open9xV4209ToSource(collectiveSource); c9x.value = value; return c9x; } t_Open9xGruvin9xModelData_v207::operator ModelData () { ModelData c9x; c9x.used = true; getEEPROMZString(c9x.name, name, sizeof(name)); for (int i=0; i 500) { c9x.phaseData[i].trimRef[j] = c9x.phaseData[i].trim[j] - 501; if (c9x.phaseData[i].trimRef[j] >= i) c9x.phaseData[i].trimRef[j] += 1; c9x.phaseData[i].trim[j] = 0; } } } for (int i=0; i> (4*line+2*col)) & 0x03) * 16); } } return c9x; } t_Open9xGruvin9xModelData_v208::operator ModelData () { ModelData c9x; c9x.used = true; getEEPROMZString(c9x.name, name, sizeof(name)); for (int i=0; i 500) { c9x.phaseData[i].trimRef[j] = c9x.phaseData[i].trim[j] - 501; if (c9x.phaseData[i].trimRef[j] >= i) c9x.phaseData[i].trimRef[j] += 1; c9x.phaseData[i].trim[j] = 0; } } } for (int i=0; i> (4*line+2*col)) & 0x03) * 16); } } for (int i=0; i 500) { c9x.phaseData[i].trimRef[j] = c9x.phaseData[i].trim[j] - 501; if (c9x.phaseData[i].trimRef[j] >= i) c9x.phaseData[i].trimRef[j] += 1; c9x.phaseData[i].trim[j] = 0; } } } for (int i=0; i> (4*line+2*col)) & 0x03) * 16); } } for (int i=0; i 500) { c9x.phaseData[i].trimRef[j] = c9x.phaseData[i].trim[j] - 501; if (c9x.phaseData[i].trimRef[j] >= i) c9x.phaseData[i].trimRef[j] += 1; c9x.phaseData[i].trim[j] = 0; } } } for (int i=0; i 500) { c9x.phaseData[i].trimRef[j] = c9x.phaseData[i].trim[j] - 501; if (c9x.phaseData[i].trimRef[j] >= i) c9x.phaseData[i].trimRef[j] += 1; c9x.phaseData[i].trim[j] = 0; } } } for (int i=0; i