Skip to content

Commit

Permalink
TEST: fix "toggle console" button doesn't work when just switched to …
Browse files Browse the repository at this point in the history
…dev mode, debugView button toggle
  • Loading branch information
way5 committed Jun 7, 2024
1 parent 82be1a6 commit 38247fb
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 21 deletions.
11 changes: 9 additions & 2 deletions public/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ const createWebSocket = () => {
optionByte4, // deintMode & wantTap6 & wantFullHeight & matchPresetSource & PalForce60
optionByte5, // wantOutputComponent & enableCalibrationADC & preferScalingRgbhv & disableExternalClockGenerator
// developer tab
optionByte6, // printInfos, invertSync, oversampling, ADC Filter
optionByte6, // printInfos, invertSync, oversampling, ADC Filter, debugView
// system tab
optionByte7, // enableOTA
] = bufArr
Expand Down Expand Up @@ -672,6 +672,9 @@ const createWebSocket = () => {
const adcFilter = document.querySelector(
`button[gbs-message="F"][gbs-message-type="action"]`
)
const debugView = document.querySelector(
`button[gbs-message="D"][gbs-message-type="action"]`
)
if ((optionByte6 & 0x01) == 0x01)
printInfoButton.setAttribute('active', '')
else printInfoButton.removeAttribute('active')
Expand All @@ -682,6 +685,9 @@ const createWebSocket = () => {
else oversampling.removeAttribute('active')
if ((optionByte6 & 0x08) == 0x08) adcFilter.setAttribute('active', '')
else adcFilter.removeAttribute('active')
if ((optionByte6 & 0x10) == 0x10)
debugView.setAttribute('active', '')
else debugView.removeAttribute('active')

// system tab
const enableOTAButton = document.querySelector(
Expand Down Expand Up @@ -1227,7 +1233,8 @@ const toggleDeveloperMode = () => {
const developerMode = GBSStorage.read('developerMode') || false

GBSStorage.write('developerMode', !developerMode)
updateDeveloperMode(!developerMode)
// updateDeveloperMode(!developerMode)
initDeveloperMode();
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# File: main.cpp #
# File Created: Friday, 19th April 2024 3:13:38 pm #
# Author: Robert Neumann #
# Last Modified: Sunday, 2nd June 2024 11:15:45 pm #
# Last Modified: Friday, 7th June 2024 4:52:58 pm #
# Modified By: Sergey Ko #
# #
# License: GPLv3 #
Expand Down Expand Up @@ -168,6 +168,7 @@ void setup()

// dev
rto->invertSync = false;
rto->debugView = false;

adco->r_gain = 0;
adco->g_gain = 0;
Expand Down
1 change: 1 addition & 0 deletions src/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ struct runTimeOptions
bool extClockGenDetected;
// dev
bool invertSync;
bool debugView;
};
// remember adc options across presets
struct adcOptions
Expand Down
3 changes: 2 additions & 1 deletion src/presets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# File: preset.cpp #
# File Created: Thursday, 2nd May 2024 6:38:23 pm #
# Author: #
# Last Modified: Sunday, 2nd June 2024 11:34:42 pm #
# Last Modified: Friday, 7th June 2024 4:52:58 pm #
# Modified By: Sergey Ko #
#####################################################################################
# CHANGELOG: #
Expand Down Expand Up @@ -96,6 +96,7 @@ void setResetParameters()

// DEV
rto->invertSync = false;
rto->debugView = false;

adco->r_gain = 0;
adco->g_gain = 0;
Expand Down
10 changes: 6 additions & 4 deletions src/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# File: video.cpp #
# File Created: Thursday, 2nd May 2024 4:07:57 pm #
# Author: #
# Last Modified: Sunday, 2nd June 2024 11:07:47 pm #
# Last Modified: Friday, 7th June 2024 4:57:34 pm #
# Modified By: Sergey Ko #
#####################################################################################
# CHANGELOG: #
Expand Down Expand Up @@ -1410,13 +1410,15 @@ void setOutModeHdBypass(bool regsInitialized)
externalClockGenResetClock();
updateSpDynamic(0);
loadHdBypassSection(); // this would be ignored otherwise
if (GBS::ADC_UNUSED_62::read() != 0x00) {

// TODO: needs clarification (see: rto->debugView)
// if (GBS::ADC_UNUSED_62::read() != 0x00) {
// remember debug view
// if (uopt->presetPreference != 2) {
// if (uopt->resolutionID != OutputCustom) {
serialCommand = 'D';
// serialCommand = 'D';
// }
}
// }

GBS::SP_NO_COAST_REG::write(0); // enable vblank coast (just in case)
GBS::SP_COAST_INV_REG::write(0); // also just in case
Expand Down
4 changes: 3 additions & 1 deletion src/wifiman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# File: wifiman.cpp #
# File Created: Friday, 19th April 2024 2:25:33 pm #
# Author: Sergey Ko #
# Last Modified: Friday, 7th June 2024 12:13:29 pm #
# Last Modified: Friday, 7th June 2024 4:52:58 pm #
# Modified By: Sergey Ko #
#####################################################################################
# CHANGELOG: #
Expand Down Expand Up @@ -151,6 +151,8 @@ void updateWebSocketData()
toSend[6] |= (1 << 2);
if(GBS::ADC_FLTR::read() != 0)
toSend[6] |= (1 << 3);
if(rto->debugView)
toSend[6] |= (1 << 4);

// system tab controls
if(rto->allowUpdatesOTA)
Expand Down
29 changes: 17 additions & 12 deletions src/wserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# fs::File: server.cpp #
# fs::File Created: Friday, 19th April 2024 3:11:40 pm #
# Author: Sergey Ko #
# Last Modified: Friday, 7th June 2024 4:13:41 pm #
# Last Modified: Friday, 7th June 2024 4:55:29 pm #
# Modified By: Sergey Ko #
#####################################################################################
# CHANGELOG: #
Expand Down Expand Up @@ -986,10 +986,10 @@ void handleSerialCommand()
togglePhaseAdjustUnits();
// enableVDS();
break;
case 'D':
case 'D': // toggle debug mode
_WS(F("debug view: "));
if (GBS::ADC_UNUSED_62::read() == 0x00)
{ // "remembers" debug view
{
// if (uopt->wantPeaking == 0) { GBS::VDS_PK_Y_H_BYPS::write(0); } // 3_4e 0 // enable peaking but don't store
GBS::VDS_PK_LB_GAIN::write(0x3f); // 3_45
GBS::VDS_PK_LH_GAIN::write(0x3f); // 3_47
Expand All @@ -1006,6 +1006,7 @@ void handleSerialCommand()
GBS::HD_V_OFFSET::write(GBS::HD_V_OFFSET::read() + 0x24);
}
// GBS::IF_IN_DREG_BYPS::write(1); // enhances noise from not delaying IF processing properly
rto->debugView = true;
_WSN(F("on"));
}
else
Expand Down Expand Up @@ -1035,6 +1036,7 @@ void handleSerialCommand()
GBS::ADC_UNUSED_60::write(0); // .. and clear
GBS::ADC_UNUSED_61::write(0);
GBS::ADC_UNUSED_62::write(0);
rto->debugView = false;
_WSN(F("off"));
}
serialCommand = '@';
Expand Down Expand Up @@ -1123,7 +1125,7 @@ void handleSerialCommand()
writeProgramArrayNew(pal_240p, false);
doPostPresetLoadSteps();
break;
case '.':
case '.': // resync HTotal
{
if (!rto->outModeHdBypass)
{
Expand All @@ -1140,8 +1142,9 @@ void handleSerialCommand()
autoBestHtotalSuccess = runAutoBestHTotal();
if (!autoBestHtotalSuccess)
{
_WSN(F("(unchanged)"));
}
_WSN(F("HTotal is unchanged"));
} else
_WSN(F("resync HTotal success"));
}
}
}
Expand Down Expand Up @@ -1952,10 +1955,11 @@ void handleSerialCommand()
{
// in case we handled a Serial or web server command and there's no more extra commands
// but keep debug view command (resets once called)
if (serialCommand != 'D')
{
serialCommand = '@';
}
// @sk: we have rto->debugView
// if (serialCommand != 'D')
// {
// serialCommand = '@';
// }
wifiLoop(1);
}
}
Expand Down Expand Up @@ -2446,14 +2450,15 @@ void handleUserCommand()
_WSN(F("off"));
}
break;
case 'F':
// freeze pic
case 'F': // freeze pic
if (GBS::CAPTURE_ENABLE::read())
{
_WSN(F("capture: disabled"));
GBS::CAPTURE_ENABLE::write(0);
}
else
{
_WSN(F("capture: enabled"));
GBS::CAPTURE_ENABLE::write(1);
}
break;
Expand Down

0 comments on commit 38247fb

Please sign in to comment.