Skip to content

Commit

Permalink
global time中間データ反映
Browse files Browse the repository at this point in the history
  • Loading branch information
Blue-Crescent committed Feb 17, 2024
1 parent 1299fe1 commit 39fd7af
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=JJYReceiver
version=0.7.3
version=0.7.4
author=BlueCrescent
maintainer=BlueCrescent <[email protected]>
sentence=JJY standard radio signal wave receiver library.
Expand Down
16 changes: 10 additions & 6 deletions src/JJYReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,20 @@ void JJYReceiver::shift_in(uint8_t data,volatile uint8_t* sampling, int length){

bool JJYReceiver::timeCheck(){
int compare[6][2] = {{0, 1}, {0, 2}, {1, 0}, {1, 2}, {2, 0}, {2, 1}};
uint8_t min1,min2;
uint8_t min[2];
uint8_t hour00[2];
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;
min[0] = ((jjydata[compare[i][0]].bits.min >> 5) & 0x7) * 10 + (jjydata[compare[i][0]].bits.min & 0x0f) + 1;
min[1] = ((jjydata[compare[i][1]].bits.min >> 5) & 0x7) * 10 + (jjydata[compare[i][1]].bits.min & 0x0f) + 2;
hour00[0] = min[0] ? 1 : 0;
hour00[1] = min[1] ? 1 : 0;
if (jjydata[compare[i][0]].bits.year == jjydata[compare[i][1]].bits.year &&
jjydata[compare[i][0]].bits.doyh == jjydata[compare[i][1]].bits.doyh &&
jjydata[compare[i][0]].bits.doyl == jjydata[compare[i][1]].bits.doyl &&
jjydata[compare[i][0]].bits.hour == jjydata[compare[i][1]].bits.hour &&
(abs((min2 - min1 + 60) % 60) <= 2))
(jjydata[compare[i][0]].bits.hour + hour00[0]) == (jjydata[compare[i][1]].bits.hour + hour00[1]) &&
(abs((min[1] - min[0] + 60) % 60) <= 2))
{
last_jjydata[0] = (min2 > min1) ? jjydata[compare[i][1]] : jjydata[compare[i][0]];
last_jjydata[0] = (min[1] > min[0]) ? jjydata[compare[i][1]] : jjydata[compare[i][0]];
state = TIMEVALID;
power(false);
return true;
Expand All @@ -132,6 +135,7 @@ time_t JJYReceiver::getTime() {
timeavailable = -1;
switch(reliability){
case 1:
globaltime = updateTimeInfo(jjydata,rcvcnt,1);
return temp_time;
break;
}
Expand Down

0 comments on commit 39fd7af

Please sign in to comment.