update to new reciver type
This commit is contained in:
22
main.cpp
22
main.cpp
@ -18,15 +18,15 @@
|
|||||||
#include "dht11.h"
|
#include "dht11.h"
|
||||||
#include "WirelessRelay.h"
|
#include "WirelessRelay.h"
|
||||||
|
|
||||||
//#define HAS_DHT
|
#define HAS_DHT
|
||||||
#define HAS_TRANSMITTER
|
//#define HAS_TRANSMITTER
|
||||||
//#define HAS_RECIVER
|
#define HAS_RECIVER
|
||||||
|
|
||||||
#define MAX_SENSORS 32
|
#define MAX_SENSORS 32
|
||||||
#define COMMAND_BUFFER_SIZE 64
|
#define COMMAND_BUFFER_SIZE 64
|
||||||
#define SNPRINTF_BUFFER_SIZE 96
|
#define SNPRINTF_BUFFER_SIZE 96
|
||||||
|
|
||||||
#define welcomeString "HELO "
|
#define welcomeString "HELO SAS"
|
||||||
static constexpr bool bdayMsg = false;
|
static constexpr bool bdayMsg = false;
|
||||||
|
|
||||||
void buttonHandler(uint8_t index, uint8_t type, void* data);
|
void buttonHandler(uint8_t index, uint8_t type, void* data);
|
||||||
@ -61,7 +61,7 @@ volatile bool relaySetting = false;
|
|||||||
|
|
||||||
volatile uint8_t timer = 0;
|
volatile uint8_t timer = 0;
|
||||||
|
|
||||||
ISR(INT1_vect)
|
ISR(TIMER1_COMPA_vect)
|
||||||
{
|
{
|
||||||
W433DataReciver::staticInterrupt();
|
W433DataReciver::staticInterrupt();
|
||||||
}
|
}
|
||||||
@ -189,7 +189,8 @@ void serialDispatch(Serial* serial, SVector<Sensor, MAX_SENSORS>* sensors)
|
|||||||
if(strcmp(token, "date") == 0)
|
if(strcmp(token, "date") == 0)
|
||||||
{
|
{
|
||||||
DS1302::Timeval time = clock.getTime();
|
DS1302::Timeval time = clock.getTime();
|
||||||
snprintf(buffer, SNPRINTF_BUFFER_SIZE, "%04u.%02u.%02u %02u:%02u:%02u\n", time.year, time.month, time.day, time.hour, time.min, time.sec);
|
snprintf(buffer, SNPRINTF_BUFFER_SIZE, "%04u.%02u.%02u %02u:%02u:%02u\n", time.year, time.month, time.day, time.hour,
|
||||||
|
time.min, time.sec);
|
||||||
serial->write(buffer, SNPRINTF_BUFFER_SIZE);
|
serial->write(buffer, SNPRINTF_BUFFER_SIZE);
|
||||||
}
|
}
|
||||||
else if(strcmp(token, "set") == 0)
|
else if(strcmp(token, "set") == 0)
|
||||||
@ -296,7 +297,8 @@ void displayItems(const DS1302::Timeval& time, int16_t temp, int16_t humid)
|
|||||||
sensors[displaying-DPY_FIXED_ITEMS].id,
|
sensors[displaying-DPY_FIXED_ITEMS].id,
|
||||||
sensors[displaying-DPY_FIXED_ITEMS].type,
|
sensors[displaying-DPY_FIXED_ITEMS].type,
|
||||||
sensors[displaying-DPY_FIXED_ITEMS].field);
|
sensors[displaying-DPY_FIXED_ITEMS].field);
|
||||||
display.setString(buffer, sensors[displaying-DPY_FIXED_ITEMS].type == 1 || sensors[displaying-2].type == 2 ? DualCl56::DP_G : 0);
|
display.setString(buffer, sensors[displaying-DPY_FIXED_ITEMS].type == 1
|
||||||
|
|| sensors[displaying-2].type == 2 ? DualCl56::DP_G : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,7 +385,11 @@ int main()
|
|||||||
sensor.read();
|
sensor.read();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
W433DataReciver reciver(&PIND, PD3, &TCNT1, &TIFR1, &packetHandler, reinterpret_cast<void*>(&serial), &reciverError);
|
//enable interrupt
|
||||||
|
TIMSK1 |= 1 << OCIE1A;
|
||||||
|
OCR1A = W433DataReciver::calculateOverflowRegister(2000, 1);
|
||||||
|
TCCR1B = 1<<CS10 | 1<<WGM12;
|
||||||
|
W433DataReciver reciver(&PIND, PD3, &packetHandler, reinterpret_cast<void*>(&serial), &reciverError);
|
||||||
|
|
||||||
uint8_t deleteDate = 0;
|
uint8_t deleteDate = 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user