timekeeper fixes (still experimental)

This commit is contained in:
Klaus K Wilting committed 2019-02-27 00:52:27 +01:00
1 parent 55e0c73c77
commit 7e4a360bb7
16 files changed
+106 -98

No files matched your search

-1
View File
@@ -5,7 +5,6 @@
#include "cyclic.h"
extern uint8_t DisplayState;
extern timesource_t timeSource;
extern HAS_DISPLAY u8x8;
+7 -7
View File
@@ -41,13 +41,13 @@
#define SCREEN_MODE (0x80)
// I2C bus access control
#define I2C_MUTEX_LOCK()
xSemaphoreTake(I2Caccess,
(3 * DISPLAYREFRESH_MS / portTICK_PERIOD_MS)) == pdTRUE
#define I2C_MUTEX_LOCK() \
xSemaphoreTake(I2Caccess, (3 * DISPLAYREFRESH_MS / portTICK_PERIOD_MS)) == \
pdTRUE
#define I2C_MUTEX_UNLOCK() xSemaphoreGive(I2Caccess)
// Struct holding devices's runtime configuration
typedef struct {
// Struct holding devices's runtime configuration
typedef struct {
uint8_t lorasf; // 7-12, lora spreadfactor
uint8_t txpower; // 2-15, lora tx power
uint8_t adrmode; // 0=disabled, 1=enabled
@@ -108,8 +108,8 @@ extern char display_line6[], display_line7[]; // screen buffers
extern uint8_t volatile channel; // wifi channel rotation counter
extern uint16_t volatile macs_total, macs_wifi, macs_ble,
batt_voltage; // display values
extern bool volatile TimePulseTick; // one-pulse-per-second flags set by GPS or
// RTC
extern bool volatile TimePulseTick; // 1sec pps flag set by GPS or RTC
extern timesource_t timeSource;
extern hw_timer_t *sendCycle, *displaytimer, *clockCycle;
extern SemaphoreHandle_t I2Caccess, TimePulse;
extern TaskHandle_t irqHandlerTask, ClockTask;
+4
View File
@@ -9,10 +9,14 @@
#include <Wire.h>
#endif
#define NMEA_FRAME_SIZE 80 // NEMA has a maxium of 80 bytes per record
#define NMEA_BUFFERTIME 50 // 50ms safety time regardless
extern TinyGPSPlus gps; // Make TinyGPS++ instance globally availabe
extern gpsStatus_t
gps_status; // Make struct for storing gps data globally available
extern TaskHandle_t GpsTask;
extern TickType_t const gpsDelay_ticks; // time to NMEA arrival
int gps_init(void);
void gps_read(void);
+1
View File
@@ -9,6 +9,7 @@
#include "globals.h"
#include "cyclic.h"
#include "senddata.h"
#include "timekeeper.h"
void irqHandler(void *pvParameters);
void IRAM_ATTR homeCycleIRQ();
+3 -2
View File
@@ -1,7 +1,8 @@
#ifndef _PAYLOAD_H_
#define _PAYLOAD_H_
// MyDevices CayenneLPP channels for dynamic sensor payload format
// MyDevices CayenneLPP 1.0 channels for Synamic sensor payload format
// all payload goes out on LoRa FPort 1
#if (PAYLOAD_ENCODER == 3)
#define LPP_GPS_CHANNEL 20
@@ -19,7 +20,7 @@
#endif
// MyDevices CayenneLPP types
// MyDevices CayenneLPP 2.0 types for Packed Sensor Payload, not using channels, but different FPorts
#define LPP_GPS 136 // 3 byte lon/lat 0.0001 °, 3 bytes alt 0.01m
#define LPP_TEMPERATURE 103 // 2 bytes, 0.1°C signed MSB
#define LPP_DIGITAL_INPUT 0 // 1 byte
+1 -1
View File
@@ -18,7 +18,7 @@ extern const char timeSetSymbols[];
void IRAM_ATTR CLOCKIRQ(void);
void clock_init(void);
void clock_loop(void *pvParameters);
time_t time_sync(void);
void timeSync(void);
void timepulse_start(void);
uint8_t timepulse_init(void);
time_t TimeIsValid(time_t const t);