variable framerate (anim effect)
This commit is contained in:
parent
c7e51cde95
commit
90e0f98b92
|
@ -17,7 +17,7 @@ struct MemSlot
|
||||||
|
|
||||||
MemSlot memory[] = //128 bytes for the Teensy LC
|
MemSlot memory[] = //128 bytes for the Teensy LC
|
||||||
{
|
{
|
||||||
{"prst", 1, 0}, //preset
|
{"alt", 1, 0}, //preset
|
||||||
{"bt1", 2, 0}, //button mode (0 = default, 1 = toggle)
|
{"bt1", 2, 0}, //button mode (0 = default, 1 = toggle)
|
||||||
{"bt2", 3, 0},
|
{"bt2", 3, 0},
|
||||||
{"bt3", 4, 0},
|
{"bt3", 4, 0},
|
||||||
|
@ -31,7 +31,8 @@ MemSlot memory[] = //128 bytes for the Teensy LC
|
||||||
{"bt11", 12, 0},
|
{"bt11", 12, 0},
|
||||||
{"bt12", 13, 0},
|
{"bt12", 13, 0},
|
||||||
{"effc", 14, 1},
|
{"effc", 14, 1},
|
||||||
{"reset", 0, 0}, // != 0 -> reset eeprom
|
{"afps", 15, 24},
|
||||||
|
{"clea", 0, 0}, // != 0 -> reset eeprom
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,22 +50,23 @@ struct MenuItem
|
||||||
|
|
||||||
MenuItem menuEntries[] =
|
MenuItem menuEntries[] =
|
||||||
{
|
{
|
||||||
{"", true, "prst"},
|
{"", true, "alt"},
|
||||||
{"", false, "butt"},
|
{"", false, "btn"},
|
||||||
{"", true, "effc"},
|
{"", true, "effc"},
|
||||||
{"", true, "reset"},
|
{"", true, "afps"},
|
||||||
{"/butt", true, "bt1"},
|
{"", true, "clea"},
|
||||||
{"/butt", true, "bt2"},
|
{"/btn", true, "bt1"},
|
||||||
{"/butt", true, "bt3"},
|
{"/btn", true, "bt2"},
|
||||||
{"/butt", true, "bt4"},
|
{"/btn", true, "bt3"},
|
||||||
{"/butt", true, "bt5"},
|
{"/btn", true, "bt4"},
|
||||||
{"/butt", true, "bt6"},
|
{"/btn", true, "bt5"},
|
||||||
{"/butt", true, "bt7"},
|
{"/btn", true, "bt6"},
|
||||||
{"/butt", true, "bt8"},
|
{"/btn", true, "bt7"},
|
||||||
{"/butt", true, "bt9"},
|
{"/btn", true, "bt8"},
|
||||||
{"/butt", true, "bt10"},
|
{"/btn", true, "bt9"},
|
||||||
{"/butt", true, "bt11"},
|
{"/btn", true, "bt10"},
|
||||||
{"/butt", true, "bt12"},
|
{"/btn", true, "bt11"},
|
||||||
|
{"/btn", true, "bt12"},
|
||||||
};
|
};
|
||||||
|
|
||||||
String menuCurrentPath = "";
|
String menuCurrentPath = "";
|
||||||
|
@ -194,7 +196,7 @@ void initEepromMemory()
|
||||||
{
|
{
|
||||||
EEPROM.write(memory[i].address, memory[i].value);
|
EEPROM.write(memory[i].address, memory[i].value);
|
||||||
}
|
}
|
||||||
EEPROM.write(getMemorySlot("reset")->address,0);
|
EEPROM.write(getMemorySlot("clea")->address,0);
|
||||||
}
|
}
|
||||||
//read eeprom
|
//read eeprom
|
||||||
for (byte i = 0; i < (sizeof(memory)/sizeof(MemSlot)); i++)
|
for (byte i = 0; i < (sizeof(memory)/sizeof(MemSlot)); i++)
|
||||||
|
@ -427,6 +429,7 @@ bool menuSetValue(String variableName, byte newValue)
|
||||||
void applyMemoryChange()
|
void applyMemoryChange()
|
||||||
{
|
{
|
||||||
animationEnabled = (getMemorySlot("effc")->value > 0);
|
animationEnabled = (getMemorySlot("effc")->value > 0);
|
||||||
|
animationFrameDelayMillis = 1000 / max(1, getMemorySlot("afps")->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
int menuGetSelectionIndexFromPath(String path)
|
int menuGetSelectionIndexFromPath(String path)
|
||||||
|
@ -466,7 +469,7 @@ void sendInputOuput(int input)
|
||||||
{
|
{
|
||||||
int numberOfModes = sizeof(modes)/(sizeof(Action)*15);
|
int numberOfModes = sizeof(modes)/(sizeof(Action)*15);
|
||||||
|
|
||||||
int currentMode = (getMemorySlot("prst")->value) % numberOfModes;
|
int currentMode = (getMemorySlot("alt")->value) % numberOfModes;
|
||||||
//Hardware inputs ordered from the bottom left = 1 to the top right = 12 on the switch matrix,
|
//Hardware inputs ordered from the bottom left = 1 to the top right = 12 on the switch matrix,
|
||||||
Action actionToRun = modes[currentMode][input-1]; //getting the virtual inputs from the modes array.
|
Action actionToRun = modes[currentMode][input-1]; //getting the virtual inputs from the modes array.
|
||||||
//Inputs uids starts with 1, so input - 1 to get the index 0 of the array
|
//Inputs uids starts with 1, so input - 1 to get the index 0 of the array
|
||||||
|
|
Loading…
Reference in New Issue