mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-08-24 10:48:37 +02:00
Handle denials of power appropriately
This commit is contained in:
@@ -1,8 +1,15 @@
|
||||
#include "ColorDetection.h"
|
||||
|
||||
void ColorDetection::begin(void){
|
||||
Power::waitForCurrentAllowance(PowerParameters::PowerConsumers::RGBW_SENSOR, PowerParameters::CurrentConsumptions::CURRENT_SENSOR_RGBW, COLOR_DETECTION_MAX_EXECUTION_DELAY_MS, NULL);
|
||||
ColorDetection::configure(VEML_CONFIG{.mode = AUTO,.enabled = true,.exposureTime=MS40});
|
||||
if(!Power::waitForCurrentAllowance(
|
||||
PowerParameters::PowerConsumers::RGBW_SENSOR,
|
||||
PowerParameters::CurrentConsumptions::CURRENT_SENSOR_RGBW,
|
||||
COLOR_DETECTION_MAX_EXECUTION_DELAY_MS, NULL)){
|
||||
ESP_LOGE(TAG,"Could not get power for ColorDetection");
|
||||
throw "Could not get power for ColorDetection";
|
||||
}
|
||||
ColorDetection::configure(
|
||||
VEML_CONFIG{.mode = AUTO, .enabled = true, .exposureTime = MS40});
|
||||
};
|
||||
void ColorDetection::configure(VEML_CONFIG config){
|
||||
uint8_t configRegister = 0;
|
||||
|
@@ -31,6 +31,7 @@
|
||||
|
||||
#define COLOR_DETECTION_MAX_EXECUTION_DELAY_MS 1
|
||||
|
||||
#define TAG "ColorDetection"
|
||||
|
||||
enum duration{
|
||||
MS40,
|
||||
|
Reference in New Issue
Block a user