Compare commits
No commits in common. "ac60546eabe2dd0dc6d6471e29a676ccf98ff266" and "b02df7d69bcc433e7e74a17971e0121c4ee31a51" have entirely different histories.
ac60546eab
...
b02df7d69b
4 changed files with 12 additions and 46 deletions
|
@ -53,7 +53,7 @@ void MHZ19C::calibrate(void) {
|
|||
digitalWrite(calpin, LOW);
|
||||
delay(7500);
|
||||
digitalWrite(calpin, HIGH);
|
||||
pinMode(calpin, INPUT_PULLUP);
|
||||
pinMode(PIN_PB4, INPUT_PULLUP);
|
||||
}
|
||||
|
||||
uint8_t MHZ19C::getSensorData(char * payload, uint8_t startbyte) {
|
||||
|
|
|
@ -49,22 +49,6 @@ uint8_t SENSAIRS8::getSensorData(char *payload, uint8_t startbyte) {
|
|||
return startbyte+2;
|
||||
}
|
||||
|
||||
void SENSAIRS8::calibrate(void) {
|
||||
pinMode(calpin, OUTPUT);
|
||||
digitalWrite(calpin, LOW);
|
||||
delay(6000);
|
||||
digitalWrite(calpin, HIGH);
|
||||
pinMode(calpin, INPUT_PULLUP);
|
||||
}
|
||||
|
||||
void SENSAIRS8::initialize(void) {
|
||||
// Disable Auto Background Calibration
|
||||
uint8_t _cmd[8] = {0xFE, 0x06, 0x00, 0x01F, 0x00, 0x00, 0xAC, 0x03};
|
||||
while (Serial.available() > 0) Serial.read();
|
||||
Serial.write(_cmd, 8);
|
||||
Serial.flush();
|
||||
}
|
||||
|
||||
// Read a Sensor Response
|
||||
uint8_t SENSAIRS8::read() {
|
||||
// Number of returned Bytes
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
class SENSAIRS8 : public AttSensor {
|
||||
private:
|
||||
uint8_t buffer[SER_BUF_LEN];
|
||||
pin_size_t calpin = PIN_PB4; // PB4 is the Calibration Pin on the Addon PCB
|
||||
|
||||
uint8_t read();
|
||||
void zeroBuffer(void);
|
||||
|
@ -44,8 +43,8 @@ class SENSAIRS8 : public AttSensor {
|
|||
public:
|
||||
SENSAIRS8(void);
|
||||
uint8_t getSensorData(char *payload, uint8_t startbyte);
|
||||
void calibrate(void);
|
||||
void initialize(void);
|
||||
void calibrate(void) {};
|
||||
void initialize(void) {};
|
||||
uint8_t numBytes(void) {return 2;};
|
||||
};
|
||||
|
||||
|
|
17
src/main.cpp
17
src/main.cpp
|
@ -157,15 +157,6 @@ void onEvent(ev_t ev) {
|
|||
// Check for Downlink
|
||||
DEBUG_PRINTLN("LoRa Packet Sent");
|
||||
WS2812B_BLINK(1,0,127,0,1000);
|
||||
if ((int)LMIC.dataLen > 0) {
|
||||
// Check for Downlinks
|
||||
// Function based in Ports:
|
||||
// Port 1
|
||||
// Set Sending Interval
|
||||
// Port 2
|
||||
// Do Calibration
|
||||
switch((uint8_t)LMIC.frame[LMIC.dataBeg-1]) {
|
||||
case 1:
|
||||
if ((int)LMIC.dataLen == 2) {
|
||||
// We got a Packet with the right size - lets assemble it into a uint16_t
|
||||
DEBUG_PRINTLN("Received Downlink")
|
||||
|
@ -176,14 +167,6 @@ void onEvent(ev_t ev) {
|
|||
EEPROM.put(ADDR_SLP, tmpslp);
|
||||
WS2812B_BLINK(1,0,0,127,250);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for (uint8_t i=0; i<NUM_SENSORS; i++)
|
||||
sensors[i]->calibrate();
|
||||
BLINK_LED(3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Got to sleep for specified Time
|
||||
DEBUG_PRINTLN("Going to Sleep");
|
||||
|
|
Loading…
Reference in a new issue