mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-05-19 11:01:46 +02:00
Add test case for modeling functions
This commit is contained in:
parent
7ed58afea0
commit
ec457d31d9
@ -8,11 +8,13 @@ void setup() {
|
|||||||
dezibot.begin();
|
dezibot.begin();
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
// init RNG
|
// 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() {
|
void loop() {
|
||||||
randomDurationMs = random(0, 10e4);
|
randomDurationMs = random(0, 100);
|
||||||
uint32_t color = random(0, 0xFFFFFF);
|
uint32_t color = random(0, 0xFFFFFF);
|
||||||
Serial.printf("Estimated current and charge consumption of turning an RGB "
|
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",
|
"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.modelCurrentConsumption(color),
|
||||||
dezibot.multiColorLight.modelChargeConsumption(
|
dezibot.multiColorLight.modelChargeConsumption(
|
||||||
TOP_LEFT, color, randomDurationMs));
|
TOP_LEFT, color, randomDurationMs));
|
||||||
randomDurationMs = random(0, 10e4);
|
randomDurationMs = random(0, 100);
|
||||||
uint32_t randomDuty = random(0, 1 << LEDC_TIMER_10_BIT);
|
uint32_t randomDuty = random(0, 1 << LEDC_TIMER_10_BIT);
|
||||||
Serial.printf(
|
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",
|
"%d ms: %f mA, %f C\n",
|
||||||
|
randomDuty,
|
||||||
randomDurationMs,
|
randomDurationMs,
|
||||||
dezibot.infraredLight.front.modelCurrentConsumption(randomDuty),
|
dezibot.infraredLight.front.modelCurrentConsumption(randomDuty),
|
||||||
dezibot.infraredLight.front.modelChargeConsumptionOn(randomDurationMs));
|
dezibot.infraredLight.front.modelChargeConsumptionOn(randomDurationMs));
|
||||||
Serial.printf(
|
Serial.printf(
|
||||||
"Estimated current and charge consumption of turning bottom IR LED on "
|
"Estimated current and charge consumption of turning bottom IR LED on at %d duty for "
|
||||||
"for "
|
|
||||||
"%d ms: %f mA, %f C\n",
|
"%d ms: %f mA, %f C\n",
|
||||||
|
randomDuty,
|
||||||
randomDurationMs,
|
randomDurationMs,
|
||||||
dezibot.infraredLight.bottom.modelCurrentConsumption(randomDuty),
|
dezibot.infraredLight.bottom.modelCurrentConsumption(randomDuty),
|
||||||
dezibot.infraredLight.bottom.modelChargeConsumptionOn(randomDurationMs));
|
dezibot.infraredLight.bottom.modelChargeConsumptionOn(randomDurationMs));
|
||||||
randomDurationMs = random(0, 10e4);
|
randomDurationMs = random(0, 100);
|
||||||
Serial.printf(
|
Serial.printf(
|
||||||
"Estimated current and charge consumption of running motor at default "
|
"Estimated current and charge consumption of running motor at default "
|
||||||
"duty cycle for "
|
"duty cycle for "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user