diff --git a/src/JJYReceiver.cpp b/src/JJYReceiver.cpp index 454d3a2..2295021 100644 --- a/src/JJYReceiver.cpp +++ b/src/JJYReceiver.cpp @@ -95,9 +95,9 @@ void JJYReceiver::shift_in(uint8_t data,volatile uint8_t* sampling, int length){ } bool JJYReceiver::timeCheck(){ - int compare[3][2] = {{0, 1}, {0, 2}, {1, 2} }; + int compare[6][2] = {{0, 1}, {0, 2}, {1, 0}, {1, 2}, {2, 0}, {2, 1}}; uint8_t min1,min2; - for (int i = 0; i < 3; i++) { + for (int i = 0; i < 6; i++) { min1 = ((jjydata[compare[i][0]].bits.min >> 5) & 0x7) * 10 + (jjydata[compare[i][0]].bits.min & 0x0f) + 1; min2 = ((jjydata[compare[i][1]].bits.min >> 5) & 0x7) * 10 + (jjydata[compare[i][1]].bits.min & 0x0f) + 2; if (jjydata[compare[i][0]].bits.year == jjydata[compare[i][1]].bits.year && diff --git a/src/JJYReceiver.h b/src/JJYReceiver.h index 58c14f4..13bf738 100644 --- a/src/JJYReceiver.h +++ b/src/JJYReceiver.h @@ -79,7 +79,6 @@ typedef union { class JJYReceiver { enum STATE {INIT,RECEIVE,TIMEVALID,TIMETICK}; - enum RCVSTATE {NONE=0,TIMEVALID0,TIMEVALID1,TIMEVALID2}; enum JJYSTATE {JJY_INIT=-1,JJY_MIN=0,JJY_HOUR=1,JJY_DOYH=2,JJY_DOYL=3,JJY_YEAR=4,JJY_WEEK=5}; public: @@ -94,7 +93,6 @@ class JJYReceiver { volatile int8_t monitorpin = -1; volatile uint8_t frequency = 0; volatile uint8_t markercount = 0; - volatile uint8_t reliability = 0; volatile uint8_t quality = 0; volatile uint8_t tick = 0; @@ -133,7 +131,6 @@ class JJYReceiver { int max_of_three(uint8_t a, uint8_t b, uint8_t c); bool calculateParity(uint8_t value, uint8_t bitLength, uint8_t expectedParity); bool timeCheck(); - //time_t updateTimeInfo(JJYData jjydata*, int8_t index, int8_t offset); time_t getTime(); time_t get_time(); time_t get_time(uint8_t index); @@ -165,8 +162,7 @@ class JJYReceiver { calculateDate(year, yday ,(uint8_t*) &timeinfo.tm_mon,(uint8_t*) &timeinfo.tm_mday); timeinfo.tm_hour = ((jjydata[index].bits.hour >> 5) & 0x3) * 10 + (jjydata[index].bits.hour & 0x0f) ; // 時 timeinfo.tm_min = ((jjydata[index].bits.min >> 5) & 0x7) * 10 + (jjydata[index].bits.min & 0x0f) + offset; // 分 - time_t temp = mktime(&timeinfo); - return temp; + return mktime(&timeinfo); } void init(){ state = RECEIVE;