Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 35 additions & 14 deletions gbs-control.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7687,12 +7687,17 @@ void updateWebSocketData()
if (uopt->enableFrameTimeLock) {
toSend[4] |= (1 << 1);
}
if (uopt->frameTimeLockMethod) {
toSend[4] |= (1 << 3);
}
if (uopt->deintMode) {
toSend[4] |= (1 << 2);
}
/*
if (uopt->wantTap6) {
toSend[4] |= (1 << 3);
}
*/
if (uopt->wantStepResponse) {
toSend[4] |= (1 << 4);
}
Expand Down Expand Up @@ -9097,16 +9102,31 @@ void handleType2Command(char argument)
} break;
case 'i':
// toggle active frametime lock method
if (!rto->extClockGenDetected) {
FrameSync::reset(uopt->frameTimeLockMethod);
// vtotal and VSST
if (uopt->enableFrameTimeLock == 1) {
uopt->frameTimeLockMethod = 0;
if (!rto->extClockGenDetected) {
FrameSync::reset(uopt->frameTimeLockMethod);
}
saveUserPrefs();
activeFrameTimeLockInitialSteps();
} else {
SerialM.println("Enable FrameTime Lock to set a method");
}
if (uopt->frameTimeLockMethod == 0) {
break;
case 'I':
// toggle active frametime lock method
// vtotal only
if (uopt->enableFrameTimeLock == 1) {
uopt->frameTimeLockMethod = 1;
} else if (uopt->frameTimeLockMethod == 1) {
uopt->frameTimeLockMethod = 0;
if (!rto->extClockGenDetected) {
FrameSync::reset(uopt->frameTimeLockMethod);
}
saveUserPrefs();
activeFrameTimeLockInitialSteps();
} else {
SerialM.println("Enable FrameTime Lock to set a method");
}
saveUserPrefs();
activeFrameTimeLockInitialSteps();
break;
case 'l':
// cycle through available SDRAM clocks
Expand Down Expand Up @@ -9542,7 +9562,7 @@ void startWebserver()
//Serial.print("got serial request params: ");
//Serial.println(params);
if (params > 0) {
AsyncWebParameter *p = request->getParam(0);
const AsyncWebParameter *p = request->getParam((size_t)0);
//Serial.println(p->name());
serialCommand = p->name().charAt(0);

Expand All @@ -9561,7 +9581,7 @@ void startWebserver()
//Serial.print("got user request params: ");
//Serial.println(params);
if (params > 0) {
AsyncWebParameter *p = request->getParam(0);
const AsyncWebParameter *p = request->getParam((size_t)0);
//Serial.println(p->name());
userCommand = p->name().charAt(0);
}
Expand Down Expand Up @@ -9623,7 +9643,7 @@ void startWebserver()
int params = request->params();

if (params > 0) {
AsyncWebParameter *slotParam = request->getParam(0);
const AsyncWebParameter *slotParam = request->getParam((size_t)0);
String slotParamValue = slotParam->value();
char slotValue[2];
slotParamValue.toCharArray(slotValue, sizeof(slotValue));
Expand Down Expand Up @@ -9670,15 +9690,15 @@ void startWebserver()
}

// index param
AsyncWebParameter *slotIndexParam = request->getParam(0);
const AsyncWebParameter *slotIndexParam = request->getParam((size_t)0);
String slotIndexString = slotIndexParam->value();
uint8_t slotIndex = lowByte(slotIndexString.toInt());
if (slotIndex >= SLOTS_TOTAL) {
goto fail;
}

// name param
AsyncWebParameter *slotNameParam = request->getParam(1);
const AsyncWebParameter *slotNameParam = request->getParam((size_t)1);
String slotName = slotNameParam->value();

char emptySlotName[25] = " ";
Expand Down Expand Up @@ -9708,7 +9728,7 @@ void startWebserver()
server.on("/slot/remove", HTTP_GET, [](AsyncWebServerRequest *request) {
bool result = false;
int params = request->params();
AsyncWebParameter *p = request->getParam(0);
const AsyncWebParameter *p = request->getParam((size_t)0);
char param = p->name().charAt(0);
if (params > 0)
{
Expand Down Expand Up @@ -9777,6 +9797,7 @@ void startWebserver()
}
}

fail:
request->send(200, "application/json", result ? "true" : "false");
});

Expand All @@ -9803,7 +9824,7 @@ void startWebserver()
if (ESP.getFreeHeap() > 10000) {
int params = request->params();
if (params > 0) {
request->send(SPIFFS, request->getParam(0)->value(), String(), true);
request->send(SPIFFS, request->getParam((size_t)0)->value(), String(), true);
} else {
request->send(200, "application/json", "false");
}
Expand Down
144 changes: 140 additions & 4 deletions public/src/index.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,17 @@
onclick="savePreset()"
active
>
<div class="gbs-icon">fiber_manual_record</div>
<div class="gbs-icon">add_circle_outline</div>
<div>save preset</div>
</button>
<button
class="gbs-button gbs-button__control-action gbs-button__secondary"
onclick="removePreset()"
active
>
<div class="gbs-icon">highlight_remove</div>
<div>remove preset</div>
</button>
</div>
</fieldset>
</section>
Expand Down Expand Up @@ -718,6 +726,117 @@
</ul>
</div>
</fieldset>
<fieldset class="gbs-fieldset filters">
<legend class="gbs-fieldset__legend gbs-fieldset__legend--help">
<div class="gbs-icon">wb_sunny</div>
<div>Color Correction</div>
</legend>
<div class="gbs-flex">
<button
gbs-message="Z"
gbs-message-type="user"
gbs-click="repeat"
class="gbs-button gbs-button__control"
>
<div class="gbs-icon">add_circle_outline</div>
<div>Brightness</div>
</button>
<button
gbs-message="T"
gbs-message-type="user"
gbs-click="repeat"
class="gbs-button gbs-button__control"
>
<div class="gbs-icon">remove_circle_outline</div>
<div>Brightness</div>
</button>
</div>
<div class="gbs-flex">
<button
gbs-message="N"
gbs-message-type="user"
gbs-click="repeat"
class="gbs-button gbs-button__control"
>
<div class="gbs-icon">add_circle_outline</div>
<div>Contrast</div>
</button>
<button
gbs-message="M"
gbs-message-type="user"
gbs-click="repeat"
class="gbs-button gbs-button__control"
>
<div class="gbs-icon">remove_circle_outline</div>
<div>Contrast</div>
</button>
</div>
<div class="gbs-flex">
<button
gbs-message="Q"
gbs-message-type="user"
gbs-click="repeat"
class="gbs-button gbs-button__control"
>
<div class="gbs-icon">add_circle_outline</div>
<div>Pb/U gain</div>
</button>
<button
gbs-message="H"
gbs-message-type="user"
gbs-click="repeat"
class="gbs-button gbs-button__control"
>
<div class="gbs-icon">remove_circle_outline</div>
<div>Pb/U gain</div>
</button>
</div>
<div class="gbs-flex">
<button
gbs-message="P"
gbs-message-type="user"
gbs-click="repeat"
class="gbs-button gbs-button__control"
>
<div class="gbs-icon">add_circle_outline</div>
<div>Pr/V gain</div>
</button>
<button
gbs-message="S"
gbs-message-type="user"
gbs-click="repeat"
class="gbs-button gbs-button__control"
>
<div class="gbs-icon">remove_circle_outline</div>
<div>Pr/V gain</div>
</button>
</div>
<div class="gbs-flex">
<button
gbs-message="O"
gbs-message-type="user"
gbs-click="repeat"
class="gbs-button gbs-button__control"
>
<div class="gbs-icon">info</div>
<div>Info</div>
</button>
<button
gbs-message="U"
gbs-message-type="user"
gbs-click="repeat"
class="gbs-button gbs-button__control"
>
<div class="gbs-icon">settings_backup_restore</div>
<div>Default</div>
</button>
</div>
<ul class="gbs-help">
<!-- prettier-ignore -->
<li>Pb/U gain - change blue-luma gain.</li>
<li>Pr/V gain - change red-luma gain.</li>
</ul>
</fieldset>
</section>

<section name="preferences" hidden>
Expand Down Expand Up @@ -876,7 +995,7 @@
</td>
</tr>
<tr>
<td class="gbs-padding__left-16">FrameTime Lock</td>
<td class="gbs-padding__left-16 gbs-padding__bottom--16">FrameTime Lock</td>
<td
class="gbs-icon"
gbs-message="5"
Expand All @@ -888,15 +1007,32 @@
</td>
</tr>
<tr>
<td class="gbs-padding__left-16">Switch Lock Method</td>
<td class="gbs-preferences__child gbs-padding__left-16">FrameTime Lock Method</td>
</tr>
<tr>
<td class="gbs-padding__left-16">VTotal + VSST</td>
<td
class="gbs-icon"
gbs-message="i"
gbs-message-type="user"
gbs-click="normal"
style="cursor: pointer"
gbs-toggle-switch="frameTimeLockMethod_vtotal_vsst"
>
swap_horiz
toggle_off
</td>
</tr>
<tr>
<td class="gbs-padding__left-16">VTotal</td>
<td
class="gbs-icon"
gbs-message="I"
gbs-message-type="user"
gbs-click="normal"
style="cursor: pointer"
gbs-toggle-switch="frameTimeLockMethod_vtotal_only"
>
toggle_off
</td>
</tr>
<tr>
Expand Down
23 changes: 23 additions & 0 deletions public/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ const createWebSocket = () => {
case "frameTimeLock":
toggleMethod(button, (optionByte1 & 0x02) == 0x02);
break;
case "frameTimeLockMethod_vtotal_vsst":
toggleMethod(button, (optionByte1 & 0x02) == 0x02 && (optionByte1 & 0x08) != 0x08);
break;
case "frameTimeLockMethod_vtotal_only":
toggleMethod(button, (optionByte1 & 0x02) == 0x02 && (optionByte1 & 0x08) == 0x08);
break;
case "motionAdaptive":
toggleMethod(button, (optionByte1 & 0x04) == 0x04);
break;
Expand Down Expand Up @@ -373,6 +379,23 @@ const savePreset = () => {
})
.catch(() => { });
};
const removePreset = () => {
fetch(`/slot/remove?0&nocache=${new Date().getTime()}`).then(() => {
setTimeout(() => {
clearTimeout(GBSControl.wsTimeout);
// GBSControl.wsTimeout = setTimeout(timeOutWs, 6000); //TODO: calc timeout
fetch(`/slot/remove?1&nocache=${new Date().getTime()}`).then(() => {
setTimeout(() => {
fetchSlotNames().then((success) => {
if (success) {
updateSlotNames();
}
});
}, 500);
});
}, 200);
});
};
const loadPreset = () => {
loadUser("3").then(() => {
if (GBSStorage.read("customSlotFilters") === true) {
Expand Down
24 changes: 24 additions & 0 deletions public/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,12 @@ const createWebSocket = () => {
case "frameTimeLock":
toggleMethod(button, (optionByte1 & 0x02) == 0x02);
break;
case "frameTimeLockMethod_vtotal_vsst":
toggleMethod(button, (optionByte1 & 0x02) == 0x02 && (optionByte1 & 0x08) != 0x08);
break;
case "frameTimeLockMethod_vtotal_only":
toggleMethod(button, (optionByte1 & 0x02) == 0x02 && (optionByte1 & 0x08) == 0x08);
break;
case "motionAdaptive":
toggleMethod(button, (optionByte1 & 0x04) == 0x04);
break;
Expand Down Expand Up @@ -456,6 +462,24 @@ const savePreset = () => {
.catch(() => {});
};

const removePreset = () => {
fetch(`/slot/remove?0&nocache=${new Date().getTime()}`).then(() => {
setTimeout(() => {
clearTimeout(GBSControl.wsTimeout);
// GBSControl.wsTimeout = setTimeout(timeOutWs, 6000); //TODO: calc timeout
fetch(`/slot/remove?1&nocache=${new Date().getTime()}`).then(() => {
setTimeout(() => {
fetchSlotNames().then((success) => {
if (success) {
updateSlotNames();
}
});
}, 500);
});
}, 200);
});
};

const loadPreset = () => {
loadUser("3").then(() => {
if (GBSStorage.read("customSlotFilters") === true) {
Expand Down
4 changes: 4 additions & 0 deletions public/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,10 @@ section[name="alert"] {
margin-bottom: 16px;
}

.gbs-padding__bottom--16 {
padding-bottom: 16px;
}

.gbs-padding__left-16 {
padding-left: 16px;
}
Expand Down
Loading