Skip to content
Closed
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
8 changes: 8 additions & 0 deletions boards/ESP32_16MB_9MB_FS.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x300000,
app1, app, ota_1, 0x310000,0x300000,
spiffs, data, spiffs, 0x610000,0x9E0000,
coredump, data, coredump,,64K
# to create/use ffat, see https://github.com/marcmerlin/esp32_fatfsimage
53 changes: 53 additions & 0 deletions boards/esp32-s3-devkitc-1-n16r8v.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"build": {
"arduino":{
"ldscript": "esp32s3_out.ld",
"partitions": "boards/ESP32_16MB_9MB_FS.csv",
"memory_type": "qio_opi"
},
"core": "esp32",
"extra_flags": [
"-DARDUINO_ESP32S3_DEV",
"-DBOARD_HAS_PSRAM",
"-DARDUINO_USB_MODE=1",
"-DARDUINO_USB_CDC_ON_BOOT=1"
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"psram_type": "opi",
"hwids": [
[
"0x303A",
"0x1001"
]
],
"mcu": "esp32s3",
"variant": "esp32s3"
},
"connectivity": [
"wifi",
"bluetooth"
],
"debug": {
"default_tool": "esp-builtin",
"onboard_tools": [
"esp-builtin"
],
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "Espressif ESP32-S3-DevKitC-1-N16R8V (16 MB QD, 8MB PSRAM)",
"upload": {
"flash_size": "16MB",
"maximum_ram_size": 327680,
"maximum_size": 16777216,
"require_upload_port": true,
"speed": 921600
},
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html",
"vendor": "Espressif"
}
10 changes: 8 additions & 2 deletions interface/src/lib/stores/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ let analytics_data = {
max_alloc_heap: <number[]>[],
fs_used: <number[]>[],
fs_total: <number[]>[],
core_temp: <number[]>[]
core_temp: <number[]>[],
free_psram: <number[]>[],
used_psram: <number[]>[],
psram_size: <number[]>[],
};

const maxAnalyticsData = 1000; // roughly 33 Minutes of data at 1 update per 2 seconds
Expand All @@ -35,7 +38,10 @@ function createAnalytics() {
),
fs_used: [...analytics_data.fs_used, content.fs_used / 1000].slice(-maxAnalyticsData),
fs_total: [...analytics_data.fs_total, content.fs_total / 1000].slice(-maxAnalyticsData),
core_temp: [...analytics_data.core_temp, content.core_temp].slice(-maxAnalyticsData)
core_temp: [...analytics_data.core_temp, content.core_temp].slice(-maxAnalyticsData),
free_psram: [...analytics_data.free_psram, content.free_psram / 1000].slice(-maxAnalyticsData),
used_psram: [...analytics_data.used_psram, content.used_psram / 1000].slice(-maxAnalyticsData),
psram_size: [...analytics_data.psram_size, content.psram_size / 1000].slice(-maxAnalyticsData),
}));
}
};
Expand Down
1 change: 1 addition & 0 deletions interface/src/lib/types/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export type Analytics = {
max_alloc_heap: number;
psram_size: number;
free_psram: number;
used_psram: number;
free_heap: number;
total_heap: number;
min_free_heap: number;
Expand Down
103 changes: 103 additions & 0 deletions interface/src/routes/system/metrics/SystemMetrics.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,91 @@
let heapChartElement: HTMLCanvasElement;
let heapChart: Chart;

let psramChartElement: HTMLCanvasElement;
let psramChart: Chart;

let filesystemChartElement: HTMLCanvasElement;
let filesystemChart: Chart;

let temperatureChartElement: HTMLCanvasElement;
let temperatureChart: Chart;

function initPsramChart() {
psramChart = new Chart(psramChartElement, {
type: 'line',
data: {
labels: $analytics.uptime,
datasets: [
{
label: 'Total PSRAM',
borderColor: daisyColor('--p'),
backgroundColor: daisyColor('--p', 50),
borderWidth: 2,
data: $analytics.psram_size,
yAxisID: 'y'
},
{
label: 'Used PSRAM',
borderColor: daisyColor('--s'),
backgroundColor: daisyColor('--s', 50),
borderWidth: 2,
data: $analytics.used_psram,
yAxisID: 'y'
}
]
},
options: {
maintainAspectRatio: false,
responsive: true,
plugins: {
legend: {
display: true
},
tooltip: {
mode: 'index',
intersect: false
}
},
elements: {
point: {
radius: 1
}
},
scales: {
x: {
grid: {
color: daisyColor('--bc', 10)
},
ticks: {
color: daisyColor('--bc')
},
display: false
},
y: {
type: 'linear',
title: {
display: true,
text: 'PSRAM [kb]',
color: daisyColor('--bc'),
font: {
size: 16,
weight: 'bold'
}
},
position: 'left',
min: 0,
max: Math.round($analytics.psram_size[0]),
grid: { color: daisyColor('--bc', 10) },
ticks: {
color: daisyColor('--bc')
},
border: { color: daisyColor('--bc', 10) }
}
}
}
});
} //initPsramChart

onMount(() => {
heapChart = new Chart(heapChartElement, {
type: 'line',
Expand Down Expand Up @@ -235,6 +314,19 @@
heapChart.data.datasets[1].data = $analytics.max_alloc_heap;
heapChart.update('none');

// psramFound
if ($analytics.psram_size[0]) {

if (!psramChart) { //init in updateData instead of onMount aspsram needs to init first before data is received
initPsramChart();
}

psramChart.data.labels = $analytics.uptime;
psramChart.data.datasets[0].data = $analytics.psram_size;
psramChart.data.datasets[1].data = $analytics.used_psram;
psramChart.update('none');
} //psram chart

filesystemChart.data.labels = $analytics.uptime;
filesystemChart.data.datasets[0].data = $analytics.fs_used;
filesystemChart.update('none');
Expand Down Expand Up @@ -284,6 +376,17 @@
<canvas bind:this={heapChartElement} />
</div>
</div>
<!-- if psramFound -->
{#if ($analytics.psram_size[0])}
<div class="w-full overflow-x-auto">
<div
class="flex w-full flex-col space-y-1 h-60"
transition:slide|local={{ duration: 300, easing: cubicOut }}
>
<canvas bind:this={psramChartElement} />
</div>
</div>
{/if}
<div class="w-full overflow-x-auto">
<div
class="flex w-full flex-col space-y-1 h-52"
Expand Down
26 changes: 14 additions & 12 deletions interface/src/routes/system/status/SystemStatus.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -228,20 +228,22 @@
</div>
</div>

<div class="rounded-box bg-base-100 flex items-center space-x-3 px-4 py-2">
<div class="mask mask-hexagon bg-primary h-auto w-10 flex-none">
<Pyramid class="text-primary-content h-auto w-full scale-75" />
</div>
<div>
<div class="font-bold">PSRAM (Size / Free)</div>
<div class="text-sm opacity-75">
{systemInformation.psram_size.toLocaleString('en-US')} / {systemInformation.psram_size.toLocaleString(
'en-US'
)} bytes
<!-- if psramFound -->
{#if (systemInformation.psram_size)}
<div class="rounded-box bg-base-100 flex items-center space-x-3 px-4 py-2">
<div class="mask mask-hexagon bg-primary h-auto w-10 flex-none">
<Pyramid class="text-primary-content h-auto w-full scale-75" />
</div>
<div>
<div class="font-bold">PSRAM</div>
<div class="text-sm opacity-75">
{(((systemInformation.used_psram) / systemInformation.psram_size) * 100).toFixed(1)} % of {(systemInformation.psram_size / 1000).toFixed(0)} KB used
<span>({((systemInformation.free_psram) / 1000).toFixed(0)} KB free)</span>
</div>
</div>
</div>
</div>

{/if}
<div class="rounded-box bg-base-100 flex items-center space-x-3 px-4 py-2">
<div class="mask mask-hexagon bg-primary h-auto w-10 flex-none">
<Sketch class="text-primary-content h-auto w-full scale-75" />
Expand Down
5 changes: 5 additions & 0 deletions lib/framework/AnalyticsService.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ class AnalyticsService
doc["fs_used"] = ESPFS.usedBytes();
doc["fs_total"] = ESPFS.totalBytes();
doc["core_temp"] = temperatureRead();
if (psramFound()) {
doc["free_psram"] = ESP.getFreePsram();
doc["used_psram"] = ESP.getPsramSize() - ESP.getFreePsram();
doc["psram_size"] = ESP.getPsramSize();
}

JsonObject jsonObject = doc.as<JsonObject>();
_socket->emitEvent(EVENT_ANALYTICS, jsonObject);
Expand Down
7 changes: 5 additions & 2 deletions lib/framework/SystemStatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,11 @@ esp_err_t SystemStatus::systemStatus(PsychicRequest *request)
root["esp_platform"] = ESP_PLATFORM;
root["firmware_version"] = APP_VERSION;
root["max_alloc_heap"] = ESP.getMaxAllocHeap();
root["psram_size"] = ESP.getPsramSize();
root["free_psram"] = ESP.getFreePsram();
if (psramFound()) {
root["free_psram"] = ESP.getFreePsram();
root["used_psram"] = ESP.getPsramSize() - ESP.getFreePsram();
root["psram_size"] = ESP.getPsramSize();
}
root["cpu_freq_mhz"] = ESP.getCpuFreqMHz();
root["cpu_type"] = ESP.getChipModel();
root["cpu_rev"] = ESP.getChipRevision();
Expand Down
Loading