mirror of
https://github.com/team2059/Zaphod
synced 2025-01-07 22:14:14 -05:00
Tried to add a clock system
This commit is contained in:
parent
508e55c10d
commit
556aee250a
@ -3,6 +3,7 @@ HHCompressor::HHCompressor(){
|
|||||||
compressor=new Compressor(COMPRESSOR_GAUGE_SIDECAR, COMPRESSOR_GAUGE, COMPRESSOR_RELAY_SIDECAR, COMPRESSOR_RELAY);
|
compressor=new Compressor(COMPRESSOR_GAUGE_SIDECAR, COMPRESSOR_GAUGE, COMPRESSOR_RELAY_SIDECAR, COMPRESSOR_RELAY);
|
||||||
solenoid1=new Solenoid(COMPRESSOR_SOLENOID_ONE);
|
solenoid1=new Solenoid(COMPRESSOR_SOLENOID_ONE);
|
||||||
solenoid2=new Solenoid(COMPRESSOR_SOLENOID_TWO);
|
solenoid2=new Solenoid(COMPRESSOR_SOLENOID_TWO);
|
||||||
|
time(&t);
|
||||||
}
|
}
|
||||||
void HHCompressor::CompressorSystemPeriodic(){
|
void HHCompressor::CompressorSystemPeriodic(){
|
||||||
switch(e_CollectorSolenoidState){
|
switch(e_CollectorSolenoidState){
|
||||||
@ -19,12 +20,18 @@ void HHCompressor::CompressorSystemPeriodic(){
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
e_CollectorSolenoidState=IDLE;
|
time_t f;
|
||||||
if(compressor->GetPressureSwitchValue()==1){
|
time(&f);
|
||||||
compressor->Start();
|
printf("%f",difftime(t,f));
|
||||||
}else{
|
if(difftime(t,f)>1.0f){
|
||||||
compressor->Stop();
|
if(compressor->GetPressureSwitchValue()==1){
|
||||||
|
compressor->Start();
|
||||||
|
}else{
|
||||||
|
compressor->Stop();
|
||||||
|
}
|
||||||
|
t=clock();
|
||||||
}
|
}
|
||||||
|
e_CollectorSolenoidState=IDLE;
|
||||||
}
|
}
|
||||||
void HHCompressor::ExtendCollector(){
|
void HHCompressor::ExtendCollector(){
|
||||||
e_CollectorSolenoidState=EXTENDED;
|
e_CollectorSolenoidState=EXTENDED;
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
#include <WPILib.h>
|
#include <WPILib.h>
|
||||||
#include "../Definitions.h"
|
#include "../Definitions.h"
|
||||||
|
#include <time.h>
|
||||||
class HHCompressor{
|
class HHCompressor{
|
||||||
private:
|
private:
|
||||||
Compressor *compressor;
|
Compressor *compressor;
|
||||||
Solenoid *solenoid1, *solenoid2;
|
Solenoid *solenoid1, *solenoid2;
|
||||||
|
time_t t;
|
||||||
public:
|
public:
|
||||||
enum{
|
enum{
|
||||||
EXTENDED,
|
EXTENDED,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user