revised RFAC process
This commit is contained in:
parent
7c928bc9b6
commit
ed27f51410
|
@ -34,30 +34,18 @@ hmac_result_t hmac_result;
|
|||
|
||||
uint32_t sts_hmac_verify(void)
|
||||
{
|
||||
uint8_t i=0;
|
||||
uint8_t uid[8]="";
|
||||
uint8_t uid[8]={0x0};
|
||||
uint32_t ret=0;
|
||||
hmac_result.ac_pass = 60;
|
||||
hmac_result.hmac_tag_size = 0;
|
||||
GetUniqueId(uid);
|
||||
|
||||
ret = sts_hmac_sha1((const uint8_t *) mKey, sizeof(mKey), (const uint8_t*)(uid+4), 4, &hmac_result);
|
||||
for (i=0;i<sizeof(Computed_Tag_SHA1); i++) {
|
||||
APP_LOG(TS_OFF,VLEVEL_M,"0x%02x ", hmac_result.hmac_tag[i]);
|
||||
}
|
||||
|
||||
ret = memcmp(hmac_result.hmac_tag, (void *)sts_ac_code, sizeof(sts_ac_code));
|
||||
hmac_result.ac_pass = (ret == 0x0)?1U:0U;
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\nHMAC Verify Success = %u \r\n", hmac_result.ac_pass);
|
||||
|
||||
if (ret !=0)
|
||||
{
|
||||
hmac_result.ac_pass =0U;
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\nHMAC Verify Error \r\n");
|
||||
} else
|
||||
{
|
||||
ret =0;
|
||||
hmac_result.ac_pass = 1U;
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\nHMAC Verify Success\r\n");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -2036,15 +2036,6 @@ void OnRestoreSTSCFGContextProcess(void)
|
|||
periodicity = (periodicity > 10)? periodicity : 10; // in seconds unit
|
||||
TxPeriodicity= periodicity*1000; // to ms
|
||||
|
||||
if ((sts_cfg_nvm.ac[0] ==0x0 )&& (sts_cfg_nvm.ac[19]==0x0))
|
||||
{
|
||||
OnTxPeriodicityChanged(APP_TX_DUTYCYCLE); // in msec unit
|
||||
|
||||
} else
|
||||
{ // ensure it's not in production yet
|
||||
OnTxPeriodicityChanged(TxPeriodicity); // in msec unit
|
||||
}
|
||||
|
||||
uint32_t samplingperiodicity = (sts_cfg_nvm.sampling); //Heart-beat or Sampling interval
|
||||
if ((char)sts_cfg_nvm.s_unit =='M') {
|
||||
samplingperiodicity *= 60;
|
||||
|
@ -2054,16 +2045,25 @@ void OnRestoreSTSCFGContextProcess(void)
|
|||
samplingperiodicity *= 1;
|
||||
}
|
||||
|
||||
//Heart-beat or Sampling interval
|
||||
samplingperiodicity = (samplingperiodicity > 0)? samplingperiodicity : 1; // in seconds unit
|
||||
HeartBeatPeriodicity = samplingperiodicity*1000;
|
||||
if ((sts_cfg_nvm.ac[0] ==0x0 )&& (sts_cfg_nvm.ac[19]==0x0))
|
||||
{
|
||||
OnTxPeriodicityChanged(APP_TX_DUTYCYCLE); // in msec unit
|
||||
OnYunhornSTSHeartBeatPeriodicityChanged(HeartBeatPeriodicity);
|
||||
} else
|
||||
{ // ensure it's not in production yet
|
||||
OnTxPeriodicityChanged(TxPeriodicity); // in msec unit
|
||||
//Heart-beat or Sampling interval
|
||||
samplingperiodicity = (samplingperiodicity > 0)? samplingperiodicity : 1; // in seconds unit
|
||||
HeartBeatPeriodicity = samplingperiodicity*1000;
|
||||
|
||||
#if defined(YUNHORN_STS_O6_ENABLED) ||defined(YUNHORN_STS_O5_ENABLED)
|
||||
OnYunhornSTSSamplingPeriodicityChanged(HeartBeatPeriodicity); // in m-sec unit
|
||||
OnYunhornSTSSamplingPeriodicityChanged(HeartBeatPeriodicity); // in m-sec unit
|
||||
#endif
|
||||
|
||||
#if defined(YUNHORN_STS_R0_ENABLED)||defined(YUNHORN_STS_R5_ENABLED)
|
||||
OnYunhornSTSHeartBeatPeriodicityChanged(HeartBeatPeriodicity);
|
||||
OnYunhornSTSHeartBeatPeriodicityChanged(HeartBeatPeriodicity);
|
||||
#endif
|
||||
}
|
||||
|
||||
sts_work_mode = sts_cfg_nvm.work_mode;
|
||||
sts_service_mask = sts_cfg_nvm.sts_service_mask;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-948262260195614088" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="907577397250979377" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
@ -16,7 +16,7 @@
|
|||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-948262260195614088" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="907577397250979377" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
* @defgroup ErrCode Errors code shown on display
|
||||
* @{
|
||||
*/
|
||||
#define STS_MAX_L0_RANGE ((uint32_t) 2000)
|
||||
#define ERR_DETECT -1
|
||||
#define ERR_DEMO_RANGE_ONE 1
|
||||
#define ERR_DEMO_RANGE_MULTI 2
|
||||
|
@ -153,7 +154,7 @@ int sts_tof_vl53l0x_DetectSensors(void)
|
|||
do {
|
||||
/* Set I2C standard mode (400 KHz) before doing the first register access */
|
||||
//if (status == VL53L0X_ERROR_NONE)
|
||||
//status = VL53L0X_WrByte(pDev, 0x88, 0x00);
|
||||
status = VL53L0X_WrByte(pDev, 0x88, 0x00);
|
||||
|
||||
/* Try to read one register using default 0x52 address */
|
||||
status = VL53L0X_RdWord(pDev, VL53L0X_REG_IDENTIFICATION_MODEL_ID, &Id);
|
||||
|
@ -172,21 +173,23 @@ int sts_tof_vl53l0x_DetectSensors(void)
|
|||
pDev->I2cDevAddr = FinalAddress;
|
||||
/* Check all is OK with the new I2C address and initialize the sensor */
|
||||
status = VL53L0X_RdWord(pDev, VL53L0X_REG_IDENTIFICATION_MODEL_ID, &Id);
|
||||
if (status !=0)
|
||||
{
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "#i VL53L0X_RdWord fail\r\n");
|
||||
break;
|
||||
}
|
||||
status = VL53L0X_DataInit(pDev);
|
||||
if( status == 0 ){
|
||||
pDev->Present = 1;
|
||||
//APP_LOG(TS_OFF, VLEVEL_H, "#%u VL53L0X_SetDeviceAddress to 0x%02x\r\n",i, pDev->I2cDevAddr);
|
||||
|
||||
nDevPresent++;
|
||||
nDevMask |= 1 << i;
|
||||
pDev->Present = 1;
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "VL53L0X %d Present and initiated to final 0x%2x, Position Mask=0x%02x\r\n", pDev->Id, pDev->I2cDevAddr, nDevMask);
|
||||
|
||||
}
|
||||
else{
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "VL53L0X_DataInit %d fail\r\n", Id);
|
||||
break;
|
||||
}
|
||||
nDevPresent++;
|
||||
nDevMask |= 1 << i;
|
||||
pDev->Present = 1;
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "VL53L0X %d Present and initiated to final 0x%2x, Position Mask=0x%02x\r\n", pDev->Id, pDev->I2cDevAddr, nDevMask);
|
||||
|
||||
} else {
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "# unknown ID %x\r\n", Id);
|
||||
|
@ -344,9 +347,9 @@ void STS_TOF250_Range_Process(void)
|
|||
int i2c_time_out = I2C_TIME_OUT_BASE + count*I2C_TIME_OUT_BYTE;
|
||||
|
||||
sensor_data_ready = 0 ;
|
||||
sts_tof_distance_data[0] = 0;
|
||||
sts_tof_distance_data[1] = 0;
|
||||
sts_tof_distance_data[2] = 0;
|
||||
sts_tof_distance_data[0] = STS_MAX_L0_RANGE;
|
||||
sts_tof_distance_data[1] = STS_MAX_L0_RANGE;
|
||||
sts_tof_distance_data[2] = STS_MAX_L0_RANGE;
|
||||
|
||||
status = HAL_I2C_Master_Receive(&hi2c2, TOF250_I2C_ADDR, pdata, count, i2c_time_out);
|
||||
if (status == HAL_OK) {
|
||||
|
@ -367,17 +370,15 @@ void STS_TOF_VL53L0X_Range_Process(void)
|
|||
nSensorPresent = sts_tof_vl53l0x_DetectSensors(); // confirm sensor online
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "\r\n %u pcs sensor(s) online \r\n", nSensorPresent);
|
||||
}
|
||||
sts_tof_distance_data[0] = 0;
|
||||
sts_tof_distance_data[1] = 0;
|
||||
sts_tof_distance_data[2] = 0;
|
||||
sts_tof_distance_data[0] = STS_MAX_L0_RANGE;
|
||||
sts_tof_distance_data[1] = STS_MAX_L0_RANGE;
|
||||
sts_tof_distance_data[2] = STS_MAX_L0_RANGE;
|
||||
|
||||
if (nSensorPresent > 0)
|
||||
{
|
||||
// RangingConfig == HIGH ACCURACY, LONG RANGE, HIGH SPEED
|
||||
sts_tof_vl53l0x_SetupSingleShot(RangingConfig);
|
||||
sts_tof_distance_data[0]=0;
|
||||
sts_tof_distance_data[1]=0;
|
||||
sts_tof_distance_data[2]=0;
|
||||
|
||||
sensor_data_ready = 0 ;
|
||||
for (i=0; i< MAX_TOF_COUNT; i++)
|
||||
{
|
||||
|
@ -390,6 +391,7 @@ void STS_TOF_VL53L0X_Range_Process(void)
|
|||
if( RangingMeasurementData.RangeStatus == 0 )
|
||||
{
|
||||
sts_tof_distance_data[i] = (int)VL53L0XDevs[i].LeakyRange;
|
||||
if (sts_tof_distance_data[i] == 0) sts_tof_distance_data[i]+= STS_MAX_L0_RANGE;
|
||||
nDevMask |= (1 << i);
|
||||
sensor_data_ready |= 1;
|
||||
} else
|
||||
|
|
Loading…
Reference in New Issue