mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-05-20 19:41:47 +02:00
fixed warnings in LightDetection
This commit is contained in:
parent
9e26a704aa
commit
16c63dcdd4
@ -1,4 +1,5 @@
|
|||||||
#include "LightDetection.h"
|
#include "LightDetection.h"
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
void LightDetection::begin(void){
|
void LightDetection::begin(void){
|
||||||
LightDetection::beginInfrared();
|
LightDetection::beginInfrared();
|
||||||
@ -6,7 +7,6 @@ void LightDetection::begin(void){
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint16_t LightDetection::getValue(photoTransistors sensor){
|
uint16_t LightDetection::getValue(photoTransistors sensor){
|
||||||
uint16_t result;
|
|
||||||
switch(sensor){
|
switch(sensor){
|
||||||
//Fall Through intended
|
//Fall Through intended
|
||||||
case IR_FRONT:
|
case IR_FRONT:
|
||||||
@ -17,6 +17,9 @@ uint16_t LightDetection::getValue(photoTransistors sensor){
|
|||||||
case DL_BOTTOM:
|
case DL_BOTTOM:
|
||||||
case DL_FRONT:
|
case DL_FRONT:
|
||||||
return readDLPT(sensor);
|
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;
|
uint16_t currentReading = 0;
|
||||||
|
|
||||||
if (type == IR){
|
if (type == IR){
|
||||||
|
maxSensor = IR_FRONT;
|
||||||
for(const auto pt : allIRPTs){
|
for(const auto pt : allIRPTs){
|
||||||
currentReading = LightDetection::getValue(pt);
|
currentReading = LightDetection::getValue(pt);
|
||||||
if (currentReading > maxReading){
|
if (currentReading > maxReading){
|
||||||
@ -34,6 +38,7 @@ photoTransistors LightDetection::getBrightest(ptType type){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
maxSensor = DL_FRONT;
|
||||||
for(const auto pt : allDLPTs){
|
for(const auto pt : allDLPTs){
|
||||||
currentReading = LightDetection::getValue(pt);
|
currentReading = LightDetection::getValue(pt);
|
||||||
if (currentReading > maxReading){
|
if (currentReading > maxReading){
|
||||||
|
@ -62,7 +62,7 @@ public:
|
|||||||
* Can distingish between IR and Daylight
|
* Can distingish between IR and Daylight
|
||||||
*
|
*
|
||||||
* @param type select which PTTransistors to compare
|
* @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);
|
static photoTransistors getBrightest(ptType type);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user