big timesync code sanitization

This commit is contained in:
Klaus K Wilting committed 2020-03-04 21:54:26 +01:00
1 parent 3f2c08432d
commit 2cf52f1af6
8 files changed
+88 -87

No files matched your search

-1
View File
@@ -127,7 +127,6 @@ extern SemaphoreHandle_t I2Caccess;
extern TaskHandle_t irqHandlerTask, ClockTask;
extern TimerHandle_t WifiChanTimer;
extern Timezone myTZ;
extern time_t userUTCTime;
extern RTC_DATA_ATTR runmode_t RTC_runmode;
// application includes
-8
View File
@@ -5,9 +5,6 @@
#include "rcommand.h"
#include "timekeeper.h"
#include <driver/rtc_io.h>
#if (TIME_SYNC_LORASERVER)
#include "timesync.h"
#endif
// LMIC-Arduino LoRaWAN Stack
#include <lmic.h>
@@ -54,9 +51,4 @@ const char *getSfName(rps_t rps);
const char *getBwName(rps_t rps);
const char *getCrName(rps_t rps);
#if (TIME_SYNC_LORAWAN)
void user_request_network_time_callback(void *pVoidUserUTCTime,
int flagSuccess);
#endif
#endif
+1
View File
@@ -5,6 +5,7 @@
#include "rtctime.h"
#include "TimeLib.h"
#include "irqhandler.h"
#include "timesync.h"
#if (HAS_GPS)
#include "gpsread.h"
+5 -4
View File
@@ -1,30 +1,31 @@
#ifndef _TIMESYNC_H
#define _TIMESYNC_H
#include <chrono>
#include "globals.h"
#include "irqhandler.h"
#include "timekeeper.h"
//#define TIME_SYNC_TRIGGER 100 // threshold for time sync [milliseconds]
#define TIME_SYNC_FRAME_LENGTH 0x07 // timeserver answer frame length [bytes]
#define TIME_SYNC_FIXUP 16 // empirical calibration to fixup processing time [milliseconds]
#define TIME_SYNC_FIXUP 16 // compensation for processing time [milliseconds]
#define TIMEREQUEST_MAX_SEQNO 0xfe // threshold for wrap around seqno
#define TIMEREQUEST_FINISH \
(TIMEREQUEST_MAX_SEQNO + 1) // marker for end of timesync handshake
#define GPS_UTC_DIFF 315964800
enum timesync_t {
timesync_tx,
timesync_rx,
gwtime_sec,
gwtime_msec,
gwtime_tzsec,
no_of_timestamps
};
void timesync_init(void);
void send_timesync_req(void);
int recv_timesync_ans(const uint8_t buf[], uint8_t buf_len);
void process_timesync_req(void *taskparameter);
void store_timestamp(uint32_t timestamp, timesync_t timestamp_type);
void IRAM_ATTR process_timesync_req(void *taskparameter);
void IRAM_ATTR process_timesync_req(void *pVoidUserUTCTime, int flagSuccess);
#endif