Rev 62 | Rev 65 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 62 | Rev 63 | ||
|---|---|---|---|
| Line 137... | Line 137... | ||
| 137 | rmc_length = length < sizeof(rmc_buff) ? length : sizeof(rmc_buff); |
137 | rmc_length = length < sizeof(rmc_buff) ? length : sizeof(rmc_buff); |
| 138 | memcpy(rmc_buff, data, length); |
138 | memcpy(rmc_buff, data, length); |
| 139 | return 0; |
139 | return 0; |
| 140 | } |
140 | } |
| 141 | 141 | ||
| - | 142 | ||
| - | 143 | // check if bluetooth connected |
|
| - | 144 | uint8_t btConnected() |
|
| - | 145 | { |
|
| - | 146 | return HAL_GPIO_ReadPin(BT_STATE_GPIO_Port, BT_STATE_Pin) == GPIO_PIN_SET; |
|
| - | 147 | } |
|
| - | 148 | ||
| 142 | /* USER CODE END PFP */ |
149 | /* USER CODE END PFP */ |
| 143 | 150 | ||
| 144 | /* Private user code ---------------------------------------------------------*/ |
151 | /* Private user code ---------------------------------------------------------*/ |
| 145 | /* USER CODE BEGIN 0 */ |
152 | /* USER CODE BEGIN 0 */ |
| 146 | 153 | ||
| Line 295... | Line 302... | ||
| 295 | (void)updateLocation(&loc, &uc4); |
302 | (void)updateLocation(&loc, &uc4); |
| 296 | if (loc.valid == 'V') |
303 | if (loc.valid == 'V') |
| 297 | memset(loc.time, '-', 6); |
304 | memset(loc.time, '-', 6); |
| 298 | 305 | ||
| 299 | // if permitted, log data from RMC packet |
306 | // if permitted, log data from RMC packet |
| 300 | if (rmc_length && HAL_GPIO_ReadPin(BT_STATE_GPIO_Port, BT_STATE_Pin) == GPIO_PIN_SET) |
307 | if (rmc_length && btConnected()) |
| 301 | { |
308 | { |
| 302 | sendString(&uc3, rmc_buff, rmc_length); |
309 | sendString(&uc3, rmc_buff, rmc_length); |
| 303 | rmc_length = 0; |
310 | rmc_length = 0; |
| 304 | nextTick = HAL_GetTick() + LOGGER_INTERVAL; |
311 | nextTick = HAL_GetTick() + LOGGER_INTERVAL; |
| 305 | logCount = 0; |
312 | logCount = 0; |
| Line 382... | Line 389... | ||
| 382 | // take an avarage |
389 | // take an avarage |
| 383 | Info[i].sum += Info[i].data; |
390 | Info[i].sum += Info[i].data; |
| 384 | Info[i].count ++; |
391 | Info[i].count ++; |
| 385 | 392 | ||
| 386 | // Send items to BT if it is in connected state |
393 | // Send items to BT if it is in connected state |
| 387 | if (log && HAL_GPIO_ReadPin(BT_STATE_GPIO_Port, BT_STATE_Pin) == GPIO_PIN_SET) |
394 | if (log && btConnected()) |
| 388 | { |
395 | { |
| 389 | 396 | ||
| 390 | char outbuff[100]; |
397 | char outbuff[100]; |
| 391 | 398 | ||
| 392 | int cnt = small_sprintf(outbuff, |
399 | int cnt = small_sprintf(outbuff, |