Skip to content

Commit c188ce9

Browse files
committed
Added longer timeouts for new positioning algorithm
1 parent e7d0879 commit c188ce9

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Pozyx_definitions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@
216216
#define POZYX_DELAY_REMOTE_WRITE 5
217217
#define POZYX_DELAY_REMOTE_FUNCTION 10
218218
#define POZYX_DELAY_INTERRUPT 100
219+
#define POZYX_DELAY_POSITIONING 1000
220+
#define POZYX_DELAY_REMOTE_POSITIONING 1000
219221
#define POZYX_DELAY_CALIBRATION 1000
220222
#define POZYX_FAILURE 0x0
221223
#define POZYX_SUCCESS 0x1
@@ -259,6 +261,8 @@
259261

260262
// Division factors for converting the raw register values to meaningful physical quantities
261263
#define POZYX_POS_DIV_MM 1.0f
264+
#define POZYX_PRESS_DIVPOSITIONING 1000
265+
#define POZYX_PRESS_DIVREMOTE_POSITIONING 1000
262266
#define POZYX_PRESS_DIV_PA 1000.0f
263267
#define POZYX_ACCEL_DIV_MG 1.0f
264268
#define POZYX_GYRO_DIV_DPS 16.0f

Pozyx_lib.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ int PozyxClass::doPositioning(coordinates_t *position, uint8_t dimension, int32_
805805
return POZYX_FAILURE;
806806

807807
// now wait for the positioning to finish or generate an error
808-
if (waitForFlag_safe(POZYX_INT_STATUS_POS | POZYX_INT_STATUS_ERR, 2*POZYX_DELAY_INTERRUPT, &int_status)){
808+
if (waitForFlag_safe(POZYX_INT_STATUS_POS | POZYX_INT_STATUS_ERR, POZYX_DELAY_POSITIONING, &int_status)){
809809
if((int_status & POZYX_INT_STATUS_ERR) == POZYX_INT_STATUS_ERR)
810810
{
811811
// An error occured during positioning.
@@ -919,11 +919,11 @@ int PozyxClass::doRemotePositioning(uint16_t remote_id, coordinates_t *coordinat
919919
uint8_t firmware;
920920
getFirmwareVersion(&firmware);
921921

922-
if (firmware == 0x13) {
922+
if (firmware >= 0x13) {
923923
uint8_t params_positioning[2] = {1, 0};
924924
status = remoteRegFunctionWithoutCheck(remote_id, POZYX_DO_POSITIONING, params_positioning, 2, NULL, 0);
925925

926-
if (waitForFlag_safe(POZYX_INT_STATUS_RX_DATA , 200) == POZYX_SUCCESS){
926+
if (waitForFlag_safe(POZYX_INT_STATUS_RX_DATA , POZYX_DELAY_REMOTE_POSITIONING) == POZYX_SUCCESS){
927927
uint8_t rx_info[3]= {0,0,0};
928928
regRead(POZYX_RX_NETWORK_ID, rx_info, 3);
929929
uint16_t remote_network_id = rx_info[0] + ((uint16_t)rx_info[1]<<8);
@@ -950,7 +950,7 @@ int PozyxClass::doRemotePositioning(uint16_t remote_id, coordinates_t *coordinat
950950
}
951951

952952
// change timeout flag if crashes
953-
if (waitForFlag_safe(POZYX_INT_STATUS_RX_DATA , 200)){
953+
if (waitForFlag_safe(POZYX_INT_STATUS_RX_DATA , POZYX_DELAY_REMOTE_POSITIONING)){
954954

955955
// we received a response, now get some information about the response
956956
uint8_t rx_info[3]= {0,0,0};

0 commit comments

Comments
 (0)