使用 JavaScript能使本网站更好的工作。
首页
探索
帮助
登录
GPS
/
gpstracker-firmware
镜像自地址
https://github.com/blemasle/gpstracker-firmware.git
关注
1
点赞
0
派生
0
代码
工单
0
版本发布
8
百科
动态
浏览代码
Moved RTC time update from GPS to Core workflow rather than position acquisition. Avoid edge cases where the spend time measurement could be wrong because of time update in between the two measure points.
tags/v1.2.0
Bertrand Lemasle
6 年前
父节点
b63912bd29
当前提交
c7063a5698
共有
3 个文件被更改
,包括
16 次插入
和
6 次删除
分列视图
Diff 选项
显示统计
下载 Patch 文件
下载 Diff 文件
+15
-2
GpsTracker/Core.cpp
+1
-0
GpsTracker/Core.h
+0
-4
GpsTracker/Positions.cpp
+ 15
- 2
GpsTracker/Core.cpp
查看文件
@@ -7,14 +7,19 @@
using namespace utils;
namespace core {
uint16_t sleepTime = SLEEP_DEFAULT_TIME_SECONDS;
uint8_t stoppedInARow = SLEEP_DEFAULT_STOPPED_THRESHOLD - 1;
void main() {
bool forceBackup = false;
positions::prepareBackup()
;
bool acquired = false
;
PositionEntryMetadata metadata;
if (positions::acquire(metadata)) {
positions::prepareBackup();
acquired = positions::acquire(metadata);
if (acquired) {
positions::appendLast(metadata);
forceBackup = updateSleepTime();
@@ -22,9 +27,17 @@ namespace core {
}
positions::doBackup(forceBackup);
if (acquired) updateRtcTime();
mainunit::deepSleep(sleepTime);
}
void updateRtcTime() {
tmElements_t time;
gps::getTime(time);
rtc::setTime(time);
}
bool updateSleepTime() {
uint8_t velocity = gps::getVelocity();
uint16_t result = mapSleepTime(velocity);
+ 1
- 0
GpsTracker/Core.h
查看文件
@@ -14,6 +14,7 @@ namespace core {
extern uint16_t sleepTime;
void main();
void updateRtcTime();
bool updateSleepTime();
uint16_t mapSleepTime(uint8_t velocity);
}
+ 0
- 4
GpsTracker/Positions.cpp
查看文件
@@ -70,10 +70,6 @@ namespace positions {
uint16_t timeToFix = rtc::getTime() - before;
tmElements_t time;
gps::getTime(time);
rtc::setTime(time);
metadata = {
battery.level,
battery.voltage,
撰写
预览
正在加载...
取消
保存