Save buffer size

This commit is contained in:
Gunnar Skjold 2023-07-02 13:54:04 +02:00
parent e629bb0d68
commit 78891e8d33
4 changed files with 12 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

@ -307,11 +307,7 @@
<option value={10}>7E1</option>
<option value={11}>8E1</option>
</select>
<select name="ms" bind:value={configuration.m.s} class="in-l tr w-1/2">
{#each [64,256,512,1024,1536,2048,3072,4096] as b}
<option value={b}>{b}</option>
{/each}
</select>
<input name="ms" type="number" bind:value={configuration.m.s} min={64} max={4096} step={64} class="in-l tr w-1/2">
</div>
</div>
<div class="my-1">

View File

@ -1193,6 +1193,7 @@ void AmsWebServer::handleSave() {
meterConfig->distributionSystem = server.arg(F("md")).toInt();
meterConfig->mainFuse = server.arg(F("mf")).toInt();
meterConfig->productionCapacity = server.arg(F("mr")).toInt();
meterConfig->bufferSize = min((double) 64, ceil((server.arg(F("ms")).toInt()) / 64));
maxPwr = 0;
if(server.hasArg(F("me")) && server.arg(F("me")) == F("true")) {

View File

@ -685,6 +685,7 @@ void handleSystem(unsigned long now) {
if(!maxDetectPayloadDetectDone && now > 3600000) {
if(maxDetectedPayloadSize * 1.5 > meterConfig.bufferSize * 64) {
meterConfig.bufferSize = min((double) 64, ceil((maxDetectedPayloadSize * 1.5) / 64));
debugI_P(PSTR("Increasing RX buffer to %d bytes"), meterConfig.bufferSize * 64);
config.setMeterConfig(meterConfig);
}
maxDetectPayloadDetectDone = true;