Skip to content

Commit

Permalink
Merge pull request #71 from falconArdente/wet_dry_fog_tints
Browse files Browse the repository at this point in the history
Wet dry fog tints
  • Loading branch information
falconArdente authored Oct 15, 2024
2 parents ca51641 + 2185b20 commit 62bf890
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
28 changes: 22 additions & 6 deletions VideoCamModule/CameraLightTurnsSupplyController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <EEPROM.h>

const int TIMINGS_ADDR = 0;
const int CAUTION_BUTTON_DELAY = 450;
const int CAUTION_BUTTON_DELAY = 300;

CameraLightTurnsSupplyController::CameraLightTurnsSupplyController() {}

Expand Down Expand Up @@ -52,7 +52,6 @@ void CameraLightTurnsSupplyController::updateTimings(Timings newTimings) {
void
CameraLightTurnsSupplyController::executeCommand(CommunicationUnit::ControlCommandSet command) {
if (cautionIsPressed != command.cautionIsOn)pushCautionButton();

digitalWrite(outLeftFogLight, command.leftFogIsOn);
digitalWrite(outRightFogLight, command.rightFogIsOn);
digitalWrite(outRelayCameraSwitch, command.relayIsOn);
Expand All @@ -61,6 +60,7 @@ CameraLightTurnsSupplyController::executeCommand(CommunicationUnit::ControlComma
digitalWrite(outDisplayOn, command.displayIsOn);
setCameraState(command.cameraState);
sendCurrentState();
if (command.leftAngelEyeIsOn)fogTintIsWhite=true; // temp for POC
}

void CameraLightTurnsSupplyController::sendUpTimings() {
Expand All @@ -74,7 +74,7 @@ void CameraLightTurnsSupplyController::sendCurrentState() {
rightTurnLever.isOn(),
rightTurnLever.isDoubleClicked(),
reverseGear.isOn(),
digitalRead(outCautionSignal),
cautionIsPressed,
digitalRead(outLeftFogLight),
digitalRead(outRightFogLight),
digitalRead(outRelayCameraSwitch),
Expand Down Expand Up @@ -179,14 +179,26 @@ void CameraLightTurnsSupplyController::turnFogLightOn() {
if (leftTurnLever.isOn()) {
digitalWrite(outLeftFogLight, HIGH);
digitalWrite(outRightFogLight, LOW);
if(fogTintIsWhite){
digitalWrite(outAngelEyeLeft, HIGH);
digitalWrite(outAngelEyeRight, LOW);
}
newFogsState = LEFT_ON;
} else if (rightTurnLever.isOn()) {
digitalWrite(outRightFogLight, HIGH);
digitalWrite(outLeftFogLight, LOW);
digitalWrite(outLeftFogLight, LOW);
digitalWrite(outRightFogLight, HIGH);
if(fogTintIsWhite){
digitalWrite(outAngelEyeLeft, LOW);
digitalWrite(outAngelEyeRight, HIGH);
}
newFogsState = RIGHT_ON;
} else {
digitalWrite(outLeftFogLight, HIGH);
digitalWrite(outRightFogLight, HIGH);
if(fogTintIsWhite){
digitalWrite(outAngelEyeLeft, HIGH);
digitalWrite(outAngelEyeRight, HIGH);
}
newFogsState = BOTH_ON;
}
if (newFogsState != fogLightsState) {
Expand All @@ -198,6 +210,10 @@ void CameraLightTurnsSupplyController::turnFogLightOn() {
void CameraLightTurnsSupplyController::turnOffFogLight() {
digitalWrite(outLeftFogLight, LOW);
digitalWrite(outRightFogLight, LOW);
if(fogTintIsWhite){
digitalWrite(outAngelEyeLeft, LOW);
digitalWrite(outAngelEyeRight, LOW);
}
isChangedFlag = true;
}

Expand Down Expand Up @@ -238,4 +254,4 @@ void CameraLightTurnsSupplyController::getTimingsFromStorage() {
void CameraLightTurnsSupplyController::putTimingsToStorage() {
timings.crc = utils::crc8((byte * ) & timings, sizeof(timings));
EEPROM.put(TIMINGS_ADDR, timings);
}
}
3 changes: 2 additions & 1 deletion VideoCamModule/CameraLightTurnsSupplyController.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class CameraLightTurnsSupplyController : public ControllerForCommUnitInterface {
} fogLightsState = ALL_OFF;
bool cautionIsPressed = false;
long cautionIsTimeStamp = 0;
bool fogTintIsWhite=false;// temp for POC
//input gears
Lever reverseGear;
Lever leftTurnLever;
Expand Down Expand Up @@ -87,4 +88,4 @@ class CameraLightTurnsSupplyController : public ControllerForCommUnitInterface {
void putTimingsToStorage();
};

#endif
#endif

0 comments on commit 62bf890

Please sign in to comment.