feat: add inverted sources (#4722)

Co-authored-by: elecpower <neilh713@tpg.com.au>
This commit is contained in:
Neil Horne
2024-05-25 09:25:15 +10:00
committed by GitHub
co-authored by elecpower
parent ca50d4ee04
commit 80659c3e3f
87 changed files with 798 additions and 496 deletions
+19 -8
View File
@@ -627,23 +627,34 @@ void drawMainControlLabel(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
lcdDrawSizedText(x, y, getMainControlLabel(idx), UINT8_MAX, att);
}
void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
void drawSource(coord_t x, coord_t y, mixsrc_t idx, LcdFlags att)
{
if (idx == MIXSRC_NONE) {
uint16_t aidx = abs(idx);
bool inverted = idx < 0;
if (aidx == MIXSRC_NONE) {
lcdDrawText(x, y, STR_EMPTY, att);
}
else if (idx <= MIXSRC_LAST_INPUT) {
else if (aidx <= MIXSRC_LAST_INPUT) {
if (inverted) {
lcdDrawChar(x, y, '!');
x += 2;
}
lcdDrawChar(x+2, y+1, CHR_INPUT, TINSIZE);
lcdDrawFilledRect(x, y, 7, 7);
if (ZEXIST(g_model.inputNames[idx-MIXSRC_FIRST_INPUT]))
lcdDrawSizedText(x+8, y, g_model.inputNames[idx-MIXSRC_FIRST_INPUT], LEN_INPUT_NAME, att);
if (ZEXIST(g_model.inputNames[aidx-MIXSRC_FIRST_INPUT]))
lcdDrawSizedText(x+8, y, g_model.inputNames[aidx-MIXSRC_FIRST_INPUT], LEN_INPUT_NAME, att);
else
lcdDrawNumber(x+8, y, idx, att|LEADING0|LEFT, 2);
lcdDrawNumber(x+8, y, aidx, att|LEADING0|LEFT, 2);
}
else if (idx <= MIXSRC_LAST_LUA) {
div_t qr = div(idx-MIXSRC_FIRST_LUA, MAX_SCRIPT_OUTPUTS);
else if (aidx <= MIXSRC_LAST_LUA) {
div_t qr = div((uint16_t)(aidx-MIXSRC_FIRST_LUA), MAX_SCRIPT_OUTPUTS);
#if defined(LUA_MODEL_SCRIPTS)
if (inverted) {
lcdDrawChar(x, y, '!');
x += 2;
}
if (qr.quot < MAX_SCRIPTS && qr.rem < scriptInputsOutputs[qr.quot].outputsCount) {
lcdDrawChar(x+2, y+1, '1'+qr.quot, TINSIZE);
lcdDrawFilledRect(x, y, 7, 7);