fixed warnings in LightDetection

This commit is contained in:
hhaupt 2024-06-12 20:51:40 +02:00
parent 9e26a704aa
commit 16c63dcdd4
2 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,5 @@
#include "LightDetection.h"
#include <limits.h>
void LightDetection::begin(void){
LightDetection::beginInfrared();
@ -6,7 +7,6 @@ void LightDetection::begin(void){
};
uint16_t LightDetection::getValue(photoTransistors sensor){
uint16_t result;
switch(sensor){
//Fall Through intended
case IR_FRONT:
@ -17,6 +17,9 @@ uint16_t LightDetection::getValue(photoTransistors sensor){
case DL_BOTTOM:
case DL_FRONT:
return readDLPT(sensor);
default:
//currently not reachable, just if enum will be extended in the future
return UINT16_MAX;
}
};
@ -26,6 +29,7 @@ photoTransistors LightDetection::getBrightest(ptType type){
uint16_t currentReading = 0;
if (type == IR){
maxSensor = IR_FRONT;
for(const auto pt : allIRPTs){
currentReading = LightDetection::getValue(pt);
if (currentReading > maxReading){
@ -34,6 +38,7 @@ photoTransistors LightDetection::getBrightest(ptType type){
}
}
} else {
maxSensor = DL_FRONT;
for(const auto pt : allDLPTs){
currentReading = LightDetection::getValue(pt);
if (currentReading > maxReading){

View File

@ -62,7 +62,7 @@ public:
* Can distingish between IR and Daylight
*
* @param type select which PTTransistors to compare
* @return photoTransistors which sensor is exposed to the greatest amount of light
* @return photoTransistors which sensor is exposed to the greatest amount of light, if all sensor read 0, the front sensor is returned
*/
static photoTransistors getBrightest(ptType type);