From ec457d31d90054d1d2e2029352edc4efa0b74bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Phillip=20K=C3=BChne?= Date: Sat, 15 Feb 2025 22:42:04 +0100 Subject: [PATCH] Add test case for modeling functions --- .../Estimation_Test/Estimation_Test.ino | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/example/advanced/Power_Management_Tests/Estimation_Test/Estimation_Test.ino b/example/advanced/Power_Management_Tests/Estimation_Test/Estimation_Test.ino index bd86500..eac8906 100644 --- a/example/advanced/Power_Management_Tests/Estimation_Test/Estimation_Test.ino +++ b/example/advanced/Power_Management_Tests/Estimation_Test/Estimation_Test.ino @@ -8,11 +8,13 @@ void setup() { dezibot.begin(); Serial.begin(115200); // init RNG - randomSeed(analogRead(GPIO_NUM_42)); + int seed = analogRead(GPIO_NUM_42); + randomSeed(seed); + Serial.printf("Initialized PRNG with seed %d", seed); } void loop() { - randomDurationMs = random(0, 10e4); + randomDurationMs = random(0, 100); uint32_t color = random(0, 0xFFFFFF); Serial.printf("Estimated current and charge consumption of turning an RGB " "LED on at color 0x%06X for %d ms: %f mA, %f C\n", @@ -20,22 +22,23 @@ void loop() { dezibot.multiColorLight.modelCurrentConsumption(color), dezibot.multiColorLight.modelChargeConsumption( TOP_LEFT, color, randomDurationMs)); - randomDurationMs = random(0, 10e4); + randomDurationMs = random(0, 100); uint32_t randomDuty = random(0, 1 << LEDC_TIMER_10_BIT); Serial.printf( - "Estimated current and charge consumption of turning front IR LED on for " + "Estimated current and charge consumption of turning front IR LED on at %d duty for " "%d ms: %f mA, %f C\n", + randomDuty, randomDurationMs, dezibot.infraredLight.front.modelCurrentConsumption(randomDuty), dezibot.infraredLight.front.modelChargeConsumptionOn(randomDurationMs)); Serial.printf( - "Estimated current and charge consumption of turning bottom IR LED on " - "for " + "Estimated current and charge consumption of turning bottom IR LED on at %d duty for " "%d ms: %f mA, %f C\n", + randomDuty, randomDurationMs, dezibot.infraredLight.bottom.modelCurrentConsumption(randomDuty), dezibot.infraredLight.bottom.modelChargeConsumptionOn(randomDurationMs)); - randomDurationMs = random(0, 10e4); + randomDurationMs = random(0, 100); Serial.printf( "Estimated current and charge consumption of running motor at default " "duty cycle for "