use developer mode

This commit is contained in:
proddy
2024-10-20 19:07:29 +02:00
parent 9320316041
commit adaa58c499
3 changed files with 32 additions and 28 deletions

View File

@@ -272,28 +272,30 @@ const SystemLog = () => {
)}
</Grid>
<Grid>
{readOpen && (
<TextField
value={readValue}
onChange={(event) => {
const value = event.target.value;
if (value !== '' && !ALPHA_NUMERIC_DASH_REGEX.test(value)) {
return;
}
setReadValue(value);
}}
focused={true}
label="Send Read command"
variant="outlined"
helperText="<deviceID> <type ID> [offset] [length]"
size="small"
/>
)}
<IconButton onClick={sendReadCommand}>
<PlayArrowIcon color="primary" />
</IconButton>
</Grid>
{data.developer_mode && (
<Grid>
{readOpen && (
<TextField
value={readValue}
onChange={(event) => {
const value = event.target.value;
if (value !== '' && !ALPHA_NUMERIC_DASH_REGEX.test(value)) {
return;
}
setReadValue(value);
}}
focused={true}
label="Send Read command"
variant="outlined"
helperText="<deviceID> <type ID> [offset] [length]"
size="small"
/>
)}
<IconButton onClick={sendReadCommand}>
<PlayArrowIcon color="primary" />
</IconButton>
</Grid>
)}
</Grid>
<Box
sx={{

View File

@@ -67,4 +67,5 @@ export interface LogSettings {
max_messages: number;
compact: boolean;
psram: boolean;
developer_mode: boolean;
}

View File

@@ -237,12 +237,13 @@ void WebLogService::transmit(const QueuedLogMessage & message) {
void WebLogService::getSetValues(AsyncWebServerRequest * request, JsonVariant json) {
if ((request->method() == HTTP_GET) || (!json.is<JsonObject>())) {
// GET - return the values
auto * response = new AsyncJsonResponse(false);
JsonObject root = response->getRoot();
root["level"] = log_level();
root["max_messages"] = maximum_log_messages();
root["compact"] = compact();
root["psram"] = (EMSESP::system_.PSram() > 0);
auto * response = new AsyncJsonResponse(false);
JsonObject root = response->getRoot();
root["level"] = log_level();
root["max_messages"] = maximum_log_messages();
root["compact"] = compact();
root["psram"] = (EMSESP::system_.PSram() > 0);
root["developer_mode"] = EMSESP::system_.developer_mode();
response->setLength();
request->send(response);