1. Data Consistency of SDK Time & Distance Values with PM3 Display.
I have a requirement to replicate the values for distance & time that are displayed on the monitor exactly. I wish to know what the recommended method is.
1a) Should I use the accurate values for time and distance obtained via the CSAFE_SETUSERCFG1_CMD or should I use the standard CSAFE time and distance calls CSAFE_GETTWORK_CMD and CSAFE_GETHORIZONTAL_CMD.
1b) If it is recommended to use the accurate CSAFE_SETUSERCFG1_CMD time and distance calls what method of rounding should be used to convert the fractional values to the integer values displayed on the Monitor? (My guess is that it is to round down to the nearest integer.)
I am sorry if this seems pretty straightforward but I want to check that my values are calculated exactly the same way that the PM3 values are.
I have added a bit more detail below for clarity and in case it may be of interest to anyone.
Data Consistency of SDK Time & Distance Values with PM3 Display.
There are two methods that I can think of for achieving this.
i) Firstly using the accurate values for time & distance that are obtained via the use of the CSAFE_SETUSERCFG1_CMD (Command Identifier 0x1A).
These are CSAFE_PM_GET_WORKTIME (Command Identifier 0xA0)
and
CSAFE_PM_GET_WORKDISTANCE (Command Identifier 0xA3)
A call to both of these functions using the SDK CSAFE_command function tkcmdsetCSAFE_command(unit_address,cmd_size,cmd_data(0),rsp_size,rsp_data(0))
can be made with cmd_data = [1A, 02, A0, A3]
The only potential issue with this is the rounding up or down of the values to match the integer representation on the monitor. Obviously this depends on whether the workout is set to a fixed distance, fixed time or Just Row.
My question is whether the correct rounding function used by the PM3 is
a) to round down to the nearest completed second or metre
i.e.
counting up from 0 seconds 1.51 seconds = 1 second on the PM3 display.
or the counting down equivalent
counting down from 20 seconds 18.49 seconds = 19 seconds on the PM3 display.
or
b) to round up or down depending on whether or not the fractional value of metres or seconds is > or < *.5 metres or seconds.
i.e.
counting up from 0 seconds 1.51 seconds = 2 seconds on the PM3 display.
or the counting down equivalent
counting down from 20 seconds 18.49 seconds = 18 seconds on the PM3 display.
ii) The second option is to use the CSAFE standard time and distance calls.
The Distance value obtained using the following SDK function call.
CSAFE_GETHORIZONTAL_CMD (Command Identifier 0xA1).
The Time value is obtained using the following SDK function call.
CSAFE_GETTWORK_CMD (Command Identifier 0xA0)
A call to both of these functions using the SDK CSAFE_command function tkcmdsetCSAFE_command(unit_address,cmd_size,cmd_data(0),rsp_size,rsp_data(0))
can be made with cmd_data = [A1, A0]
The only problem using these values is that they are given as elapsed values and not as Monitor values i.e.They are always counting up and never counting down as in the case of PM3 Monitor values counting down from a set fixed distance or time.
Obviously this can be resolved by querying the initial values returned from CSAFE_PM_GET_WORKTIME and CSAFE_PM_GET_WORKDISTANCE and if necessary the workout type.
2. Data Consistency of SDK Pace & Average Pace Values with PM3 Display.
I have already had some help on this from Monsieur Lyons but I thought it might be useful to also add some information regarding consistency with Pace values because I haven't quite got them sorted out yet and it may be of use to someone else anyway.
I have had some discrepancies with both the Split time / 500m and calculation of the Average Split time / 500m.
2a) The Split time / 1000m value is obtained using the following SDK function call.
CSAFE_GETPACE_CMD (Command Identifier 0xA6)
within
tkcmdsetCSAFE_command(unit_address,cmd_size,cmd_data(0),rsp_size,rsp_data(0))
I am currently simply dividing the processed response data bytes by 2 as follows. All variables in the following code are declared as Doubles
Code: Select all
pace_Read = (rsp_data(16) + (rsp_data(17) * 256)) ‘pace in seconds / 1000 metres
pace_Tsecs = pace_Read / 2 ‘pace in total seconds / 500 metres
if pace_Tsecs > int(pace_Tsecs) then
pace_Tsecs = pace_Tsecs + 1 'rounded up pace in total secs / 500m
end if
pace_Mins = pace_Tsecs \ 60
pace_Secs = pace_Tsecs – (pace_Mins * 60)
The data values I get are broadly consistent with the values on the PM3 display however I frequently get round off problems where the SDK values vary up or down by 1 second / 500m. I believe that the PM3 is rounding these values up to the nearest 1.0 second, however I still seem to get some discrepencies when using this assumption.
Is this the correct method or am I missing something?
2b) I find it very difficult to get consistent values for the Average Split time / 500m. I calculate this based on the accurate values for time & distance that are obtained via the use of the CSAFE_SETUSERCFG1_CMD (Command Identifier 0x1A).
accurate time is obtained from CSAFE_PM_GET_WORKTIME and accurate distance is obtained from CSAFE_PM_GET_WORKDISTANCE.
Using these values the average pace in seconds per 500 metres is calculated via
Average pace (secs / 500) = accurate Time * (500 / accurate Distance).
I believe that the PM3 is rounding these values up to the nearest 0.1 second so I use
Code: Select all
Average pace = Average pace * 10
if Average pace > int(Average pace) then
Average pace = Average pace + 1 'rounded up pace in secs / 500m
end if
Average pace = int(Average pace)
Average pace = Average pace / 10
Is there a more accurate method of synchronising my calls with the sampling time used by the PM3 to obtain consistent values for the Average Split time / 500m?
Thankyou for your time.
Chris.