#include "Dezibot.h"

/*
 * This serves as an example of how to use the power management system deals with gradual changes.
 * The ColorCycle example is a good one, because it contains gradual overstepping of the power budget,
 * with the effect being easily visible.
 */

Dezibot dezibot = Dezibot();
void setup() {
  // put your setup code here, to run once:
  dezibot.begin();
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  for (int d = 0; d < 255; d++) {
    dezibot.multiColorLight.setLed(
        ALL, dezibot.multiColorLight.color(d, 0, 255 - d));
    delay(2);
    Serial.printf("current: %f, battery: %f\r\n",
                  dezibot.power.getCurrentCurrent(),
                  dezibot.power.getBatteryChargePercent());
  }

  for (int d = 0; d < 255; d++) {
    dezibot.multiColorLight.setLed(
        ALL, dezibot.multiColorLight.color(255 - d, d, 0));
    delay(2);
    Serial.printf("current: %f, battery: %f\r\n",
                  dezibot.power.getCurrentCurrent(),
                  dezibot.power.getBatteryChargePercent());
  }

  for (int d = 0; d < 255; d++) {
    dezibot.multiColorLight.setLed(
        ALL, dezibot.multiColorLight.color(0, 255 - d, d));
    delay(2);
    Serial.printf("current: %f, battery: %f\r\n",
                  dezibot.power.getCurrentCurrent(),
                  dezibot.power.getBatteryChargePercent());
  }
}
