Factory example recording GPS completion takes time
This commit is contained in:
@@ -98,7 +98,7 @@ TouchDrvGT911 touch;
|
|||||||
lv_indev_t *kb_indev = NULL;
|
lv_indev_t *kb_indev = NULL;
|
||||||
lv_indev_t *mouse_indev = NULL;
|
lv_indev_t *mouse_indev = NULL;
|
||||||
lv_indev_t *touch_indev = NULL;
|
lv_indev_t *touch_indev = NULL;
|
||||||
|
uint32_t gps_start_ms = 0;
|
||||||
|
|
||||||
LV_IMG_DECLARE(image_emoji);
|
LV_IMG_DECLARE(image_emoji);
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ static bool GPS_Recovery();
|
|||||||
extern void updateGPS(double lat, double lng,
|
extern void updateGPS(double lat, double lng,
|
||||||
uint16_t year, uint8_t month, uint8_t day,
|
uint16_t year, uint8_t month, uint8_t day,
|
||||||
uint8_t hour, uint8_t minute, uint8_t second,
|
uint8_t hour, uint8_t minute, uint8_t second,
|
||||||
double speed, uint32_t rx_char );
|
double speed, uint32_t rx_char, uint32_t use_sec);
|
||||||
extern void updateNoiseLabel(uint32_t cnt);
|
extern void updateNoiseLabel(uint32_t cnt);
|
||||||
extern void setLoRaMessage(const char *text);
|
extern void setLoRaMessage(const char *text);
|
||||||
extern void setupUI(void);
|
extern void setupUI(void);
|
||||||
@@ -471,10 +471,12 @@ void taskPlaySong(void *p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t gps_update_interval = 0;
|
||||||
|
bool update_use_second = false;
|
||||||
|
uint32_t gps_use_second = 0;
|
||||||
|
|
||||||
void loopGPS()
|
void loopGPS()
|
||||||
{
|
{
|
||||||
static uint32_t gps_update_interval = 0;
|
|
||||||
|
|
||||||
unsigned long start = millis();
|
unsigned long start = millis();
|
||||||
do {
|
do {
|
||||||
while (SerialGPS.available()) {
|
while (SerialGPS.available()) {
|
||||||
@@ -485,6 +487,14 @@ void loopGPS()
|
|||||||
} while (millis() - start < 20);
|
} while (millis() - start < 20);
|
||||||
|
|
||||||
if (gps_update_interval < millis()) {
|
if (gps_update_interval < millis()) {
|
||||||
|
|
||||||
|
bool location = gps.location.isValid();
|
||||||
|
bool datetime = (gps.date.year() > 2000);
|
||||||
|
if (location && datetime && !update_use_second) {
|
||||||
|
update_use_second = true;
|
||||||
|
gps_use_second = (millis() - gps_start_ms) / 1000;
|
||||||
|
}
|
||||||
|
|
||||||
updateGPS(gps.location.lat(),
|
updateGPS(gps.location.lat(),
|
||||||
gps.location.lng(),
|
gps.location.lng(),
|
||||||
gps.date.year(),
|
gps.date.year(),
|
||||||
@@ -494,7 +504,8 @@ void loopGPS()
|
|||||||
gps.time.minute(),
|
gps.time.minute(),
|
||||||
gps.time.second(),
|
gps.time.second(),
|
||||||
gps.speed.value(),
|
gps.speed.value(),
|
||||||
gps.charsProcessed());
|
gps.charsProcessed(),
|
||||||
|
gps_use_second);
|
||||||
gps_update_interval = millis() + 3000;
|
gps_update_interval = millis() + 3000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1039,6 +1050,8 @@ void setup()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Record GPS start time
|
||||||
|
gps_start_ms = millis();
|
||||||
|
|
||||||
lv_obj_del(logo);
|
lv_obj_del(logo);
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ typedef struct {
|
|||||||
lv_obj_t *label_time;
|
lv_obj_t *label_time;
|
||||||
lv_obj_t *label_speed;
|
lv_obj_t *label_speed;
|
||||||
lv_obj_t *label_processchar;
|
lv_obj_t *label_processchar;
|
||||||
|
lv_obj_t *label_use_seconds;
|
||||||
} Deck_GPS_t;
|
} Deck_GPS_t;
|
||||||
|
|
||||||
Deck_GPS_t sub_gps_val;
|
Deck_GPS_t sub_gps_val;
|
||||||
@@ -36,7 +37,7 @@ typedef struct {
|
|||||||
Deck_Radio_t sub_radio_val;
|
Deck_Radio_t sub_radio_val;
|
||||||
static lv_obj_t *sound_vad_label;
|
static lv_obj_t *sound_vad_label;
|
||||||
|
|
||||||
std::vector<lv_obj_t *>sub_section;
|
std::vector < lv_obj_t * > sub_section;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
LV_MENU_ITEM_BUILDER_VARIANT_1,
|
LV_MENU_ITEM_BUILDER_VARIANT_1,
|
||||||
@@ -130,11 +131,15 @@ void setLoRaMessage(const char *text)
|
|||||||
void updateGPS(double lat, double lng,
|
void updateGPS(double lat, double lng,
|
||||||
uint16_t year, uint8_t month, uint8_t day,
|
uint16_t year, uint8_t month, uint8_t day,
|
||||||
uint8_t hour, uint8_t minute, uint8_t second,
|
uint8_t hour, uint8_t minute, uint8_t second,
|
||||||
double speed, uint32_t rx_char )
|
double speed, uint32_t rx_char, uint32_t use_sec)
|
||||||
{
|
{
|
||||||
|
if (use_sec == 0) {
|
||||||
|
lv_label_set_text_fmt(sub_gps_val.label_use_seconds, "N.A");
|
||||||
|
} else {
|
||||||
|
lv_label_set_text_fmt(sub_gps_val.label_use_seconds, "%u", use_sec);
|
||||||
|
}
|
||||||
lv_label_set_text_fmt(sub_gps_val.label_lng, "%.6f", lng);
|
lv_label_set_text_fmt(sub_gps_val.label_lng, "%.6f", lng);
|
||||||
lv_label_set_text_fmt(sub_gps_val.label_lat, "%.6f", lat);
|
lv_label_set_text_fmt(sub_gps_val.label_lat, "%.6f", lat);
|
||||||
|
|
||||||
lv_label_set_text_fmt(sub_gps_val.label_date, "%u/%u/%u", year, month, day);
|
lv_label_set_text_fmt(sub_gps_val.label_date, "%u/%u/%u", year, month, day);
|
||||||
lv_label_set_text_fmt(sub_gps_val.label_time, "%u:%u:%u", hour, minute, second);
|
lv_label_set_text_fmt(sub_gps_val.label_time, "%u:%u:%u", hour, minute, second);
|
||||||
lv_label_set_text_fmt(sub_gps_val.label_speed, "%.6f", speed);
|
lv_label_set_text_fmt(sub_gps_val.label_speed, "%.6f", speed);
|
||||||
@@ -339,6 +344,7 @@ void setupUI(void)
|
|||||||
sub_section.push_back(section);
|
sub_section.push_back(section);
|
||||||
|
|
||||||
create_label(section, LV_SYMBOL_GPS, "Model", gps_model.c_str());
|
create_label(section, LV_SYMBOL_GPS, "Model", gps_model.c_str());
|
||||||
|
sub_gps_val.label_use_seconds = create_label(section, LV_SYMBOL_GPS, "Use Seconds", "N.A");
|
||||||
sub_gps_val.label_lat = create_label(section, LV_SYMBOL_GPS, "lat", "N.A");
|
sub_gps_val.label_lat = create_label(section, LV_SYMBOL_GPS, "lat", "N.A");
|
||||||
sub_gps_val.label_lng = create_label(section, LV_SYMBOL_GPS, "lng", "N.A");
|
sub_gps_val.label_lng = create_label(section, LV_SYMBOL_GPS, "lng", "N.A");
|
||||||
sub_gps_val.label_speed = create_label(section, LV_SYMBOL_SETTINGS, "Speed", "N.A");
|
sub_gps_val.label_speed = create_label(section, LV_SYMBOL_SETTINGS, "Speed", "N.A");
|
||||||
|
|||||||
Reference in New Issue
Block a user