bifravst / cat-tracker-fw

Cat Tracker Firmware
https://bifravst.github.io/
3 stars 3 forks source link

Device should fetch config after boot #38

Closed coderbyheart closed 4 years ago

coderbyheart commented 4 years ago

So it uses the correct timeouts e.g. for GPS, as configured by the user.

Righ now it starts GPS right after connecting to LTE:

[2019-11-14 14:31:49] ***** Booting Zephyr OS build v2.0.99-ncs1-rc1-11-g9be97c63368a *****
[2019-11-14 14:31:49] [00:00:01.936,492] <dbg> nrf9160_gps.init: MAGPIO set: AT%XMAGPIO=1,0,0,1,1,1574,1577
[2019-11-14 14:31:49] [00:00:01.951,568] <dbg> nrf9160_gps.init: COEX0 set: AT%XCOEX0=1,1,1570,1580
[2019-11-14 14:31:49] The cat tracker has started
[2019-11-14 14:31:49] Version: v0.31.0
[2019-11-14 14:31:49] Connecting to LTE network. This may take several minutes.
[2019-11-14 14:31:49] [00:00:01.989,227] <inf> lte_lc: Using legacy LTE PCO mode...
[2019-11-14 14:32:02] rsrp value is 55
[2019-11-14 14:32:02] [00:00:14.630,187] <err> lte_lc: Invalid CEREG response
[2019-11-14 14:32:02] [00:00:14.636,291] <err> lte_lc: Could not get network registration status
[2019-11-14 14:32:04] LTE connected!
[2019-11-14 14:32:04] Fetching modem time...
[2019-11-14 14:32:05] 14/10/19,13:32:3
[2019-11-14 14:32:05] Device get binding device
[2019-11-14 14:32:05] GPS initialized
[2019-11-14 14:32:05] Enabling PSM
[2019-11-14 14:32:05] PSM enabled
[2019-11-14 14:32:05] [00:00:18.046,569] <dbg> bifravst_cloud.broker_init: IPv4 Address found 18.195.188.246
[2019-11-14 14:32:06] [00:00:18.304,382] <dbg> nrf9160_gps.enable_gps: GPS mode is enabled
[2019-11-14 14:32:06] [00:00:18.312,042] <dbg> nrf9160_gps.enable_gps: Functional mode: 1
[2019-11-14 14:32:06] [00:00:18.318,969] <dbg> nrf9160_gps.start: GPS socket created
[2019-11-14 14:32:06] [00:00:18.329,467] <dbg> nrf9160_gps.start: GPS operational
[2019-11-14 14:32:06] GPS started successfully.
[2019-11-14 14:32:06] Searching for satellites
coderbyheart commented 4 years ago

Device fetches cfg again after boot:

[2019-11-21 16:11:46] ***** Booting Zephyr OS build v2.0.99-ncs1-rc1-761-g7e20180c004a *****
[2019-11-21 16:11:46] [00:00:00.435,607] <dbg> nrf9160_gps.init: MAGPIO set: AT%XMAGPIO=1,0,0,1,1,1574,1577
[2019-11-21 16:11:46] [00:00:00.450,744] <dbg> nrf9160_gps.init: COEX0 set: AT%XCOEX0=1,1,1570,1580
[2019-11-21 16:11:46] The cat tracker has started
[2019-11-21 16:11:46] Version: v0.39.0
[2019-11-21 16:11:46] Connecting to LTE network. This may take several minutes.
[2019-11-21 16:11:46] [00:00:00.489,776] <inf> lte_lc: Using legacy LTE PCO mode...
[2019-11-21 16:11:58] rsrp value is 73
[2019-11-21 16:12:00] LTE connected!
[2019-11-21 16:12:00] Fetching modem time...
[2019-11-21 16:12:01] 21/10/19,15:11:53
[2019-11-21 16:12:01] Device get binding device
[2019-11-21 16:12:01] GPS initialized
[2019-11-21 16:12:01] [00:00:15.520,874] <dbg> bifravst_cloud.broker_init: IPv4 Address found 18.195.188.246
[2019-11-21 16:12:08] [00:00:22.266,143] <inf> aws_jobs: Subscribe: $aws/things/352656100378903/jobs/notify-next
[2019-11-21 16:12:08] [00:00:22.276,275] <inf> aws_jobs: Subscribe: $aws/things/352656100378903/jobs/$next/get/#
[2019-11-21 16:12:08] [00:00:22.286,254] <dbg> bifravst_cloud.mqtt_evt_handler: MQTT client connected!
[2019-11-21 16:12:08] [00:00:22.294,281] <dbg> bifravst_cloud.topic_subscribe: Subscribing to: $aws/things/352656100378903/shadow/get/rejected
[2019-11-21 16:12:08] [00:00:22.305,877] <dbg> bifravst_cloud.topic_subscribe: Subscribing to: $aws/things/352656100378903/shadow/get/accepted/desired/cfg
[2019-11-21 16:12:08] [00:00:22.318,542] <dbg> bifravst_cloud.topic_subscribe: Subscribing to: $aws/things/352656100378903/shadow/update/delta
[2019-11-21 16:12:08] CLOUD_EVT_CONNECTED
[2019-11-21 16:12:08] [00:00:22.333,435] <dbg> bifravst_cloud.data_publish: Publishing to topic: $aws/things/352656100378903/shadow/get
[2019-11-21 16:12:08] [00:00:22.552,093] <inf> aws_fota: subscribed to notify-next topic
[2019-11-21 16:12:08] [00:00:22.558,990] <inf> aws_jobs: Publish topic: $aws/things/352656100378903/jobs/$next/get
[2019-11-21 16:12:08] [00:00:22.568,084] <inf> aws_jobs: Publish payload {"clientToken": ""}
[2019-11-21 16:12:09] [00:00:22.867,095] <dbg> bifravst_cloud.mqtt_evt_handler: MQTT_EVT_SUBACK: id = 2114 result = 0
[2019-11-21 16:12:09] [00:00:22.953,430] <dbg> bifravst_cloud.mqtt_evt_handler: MQTT_EVT_SUBACK: id = 1234 result = 0
[2019-11-21 16:12:09] [00:00:23.040,252] <inf> aws_fota: Received topic: $aws/things/352656100378903/shadow/get/accepted/desired/cfg
[2019-11-21 16:12:09] [00:00:23.050,994] <inf> aws_fota: Recived an unhandled MQTT publish event on topic: $aws/things/352656100378903/shadow/get/accepted/desired/cfg
[2019-11-21 16:12:09] [00:00:23.064,697] <dbg> bifravst_cloud.mqtt_evt_handler: MQTT_EVT_PUBLISH: id = 15120 len = 74 
[2019-11-21 16:12:09] CLOUD_EVT_DATA_RECEIVED
[2019-11-21 16:12:09] Decoded message: {
[2019-11-21 16:12:09]   "cfg":  {
[2019-11-21 16:12:09]           "act":  true,
[2019-11-21 16:12:09]           "mvres":        60,
[2019-11-21 16:12:09]           "mvt":  3600,
[2019-11-21 16:12:09]           "acct": 10,
[2019-11-21 16:12:09]           "actwt":        60,
[2019-11-21 16:12:09]           "gpst": 600
[2019-11-21 16:12:09]   }
[2019-11-21 16:12:09] }
[2019-11-21 16:12:09] SETTING GPST TO: 600
[2019-11-21 16:12:09] SETTING ACTIVE TO: 1
[2019-11-21 16:12:09] SETTING ACTIVE WAIT TO: 60
[2019-11-21 16:12:09] SETTING PASSIVE_WAIT TO: 60
[2019-11-21 16:12:09] SETTING MOVEMENT TIMEOUT TO: 3600
[2019-11-21 16:12:09] SETTING ACCEL THRESHOLD TIMEOUT TO: 10
[2019-11-21 16:12:09] [00:00:23.130,126] <dbg> bifravst_cloud.mqtt_evt_handler: MQTT_EVT_PUBACK: id = 18849 result = 0
[2019-11-21 16:12:09] [00:00:23.211,303] <inf> aws_fota: Received topic: $aws/things/352656100378903/jobs/$next/get/acceptedsired/cfg
[2019-11-21 16:12:09] [00:00:23.222,259] <inf> aws_fota: Got only one field: {"clientToken":"","timestamp":1574349122}
[2019-11-21 16:12:11] Enabling PSM
[2019-11-21 16:12:11] PSM enabled
[2019-11-21 16:12:12] [00:00:26.018,554] <dbg> nrf9160_gps.enable_gps: GPS mode is enabled
[2019-11-21 16:12:12] [00:00:26.026,031] <dbg> nrf9160_gps.enable_gps: Functional mode: 1
[2019-11-21 16:12:12] [00:00:26.032,958] <dbg> nrf9160_gps.start: GPS socket created
[2019-11-21 16:12:12] [00:00:26.043,548] <dbg> nrf9160_gps.start: GPS operational
[2019-11-21 16:12:12] GPS started successfully.