workable WS R6
This commit is contained in:
parent
8b4f9b13ec
commit
2739735a62
|
@ -22,11 +22,11 @@
|
|||
#include <stdio.h>
|
||||
uint32_t HX711_Buffer=0;
|
||||
volatile uint32_t gross_weight;
|
||||
int32_t net_weight;
|
||||
volatile int32_t net_weight;
|
||||
uint8_t Flag_Error;
|
||||
volatile uint32_t last_net_weight=0;
|
||||
volatile sts_sensor_t sts_sensor_data;
|
||||
volatile unsigned long sts_weight_scale_value_g = 0, sts_weight_tare_g=0;
|
||||
volatile uint32_t sts_weight_scale_value_g = 0, sts_weight_tare_g=0;
|
||||
|
||||
|
||||
|
||||
|
@ -192,7 +192,7 @@ void Get_GrossWeight(void)
|
|||
void Get_NetWeight(void)
|
||||
{
|
||||
HX711_Buffer = HX711_Read();
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\n ----- Get Netweight =%d while last gross weight=%d \r\n", HX711_Buffer, gross_weight);
|
||||
//APP_LOG(TS_OFF, VLEVEL_M, "\r\n ----- Get Netweight =%d while last gross weight=%d \r\n", HX711_Buffer, gross_weight);
|
||||
if(HX711_Buffer >= gross_weight)
|
||||
{
|
||||
net_weight = HX711_Buffer;
|
||||
|
@ -203,7 +203,7 @@ void Get_NetWeight(void)
|
|||
//当发现测试出来的重量偏大时,增加该数值。
|
||||
|
||||
//net_weight = KalmanFilter(net_weight);
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\n ##### Get Net Weight =%d \r\n", (int)net_weight);//如果测试出来的重量偏小时,减小改数值。
|
||||
APP_LOG(TS_OFF, VLEVEL_L, "\r\n ##### Get Net Weight =%d \r\n", (int)net_weight);//如果测试出来的重量偏小时,减小改数值。
|
||||
|
||||
} else {
|
||||
net_weight = 0;
|
||||
|
|
|
@ -896,6 +896,10 @@ static void SendTxData(void)
|
|||
#if defined(STS_WS)||defined(STS_R6)
|
||||
STS_WS_sensor_read(&sts_r6_sensor_data);
|
||||
#endif
|
||||
// sts_ws_sensor_data->weight_g = sts_weight_scale_value_g;
|
||||
// sts_ws_sensor_data->tare_g = sts_weight_tare_g;
|
||||
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\nWeight=%d g\r\n", sts_r6_sensor_data.weight_g);
|
||||
|
||||
#ifdef VL53LX
|
||||
#ifdef STS_P2
|
||||
|
@ -1090,12 +1094,18 @@ static void SendTxData(void)
|
|||
|
||||
/* STS-R6 WEIGHT SCALE SENSOR */
|
||||
#ifdef STS_R6
|
||||
AppData.Buffer[i++] = 4;
|
||||
AppData.Buffer[i++] = (uint8_t)((sts_r6_sensor_data.weight_g <<8)& 0xFF);
|
||||
AppData.Buffer[i++] = (uint8_t)((sts_r6_sensor_data.weight_g)& 0xFF);
|
||||
AppData.Buffer[i++] = (uint8_t)((sts_r6_sensor_data.tare_g <<8)& 0xFF);
|
||||
AppData.Buffer[i++] = 8;
|
||||
AppData.Buffer[i++] = (uint8_t)((sts_r6_sensor_data.weight_g >>24)& 0xFF);
|
||||
AppData.Buffer[i++] = (uint8_t)((sts_r6_sensor_data.weight_g >>16)& 0xFF);
|
||||
AppData.Buffer[i++] = (uint8_t)((sts_r6_sensor_data.weight_g >>8 )& 0xFF);
|
||||
AppData.Buffer[i++] = (uint8_t)((sts_r6_sensor_data.weight_g )& 0xFF);
|
||||
|
||||
AppData.Buffer[i++] = (uint8_t)((sts_r6_sensor_data.tare_g >>24)& 0xFF);
|
||||
AppData.Buffer[i++] = (uint8_t)((sts_r6_sensor_data.tare_g >>16)& 0xFF);
|
||||
AppData.Buffer[i++] = (uint8_t)((sts_r6_sensor_data.tare_g >>8)& 0xFF);
|
||||
AppData.Buffer[i++] = (uint8_t)((sts_r6_sensor_data.tare_g)& 0xFF);
|
||||
|
||||
|
||||
#endif //STS_R6
|
||||
|
||||
|
||||
|
@ -1108,6 +1118,7 @@ static void SendTxData(void)
|
|||
|
||||
|
||||
AppData.BufferSize = i&(~sts_service_mask);
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\nAppdata.buffersize = %d", AppData.BufferSize);
|
||||
|
||||
if ((JoinLedTimer.IsRunning) && (LmHandlerJoinStatus() == LORAMAC_HANDLER_SET))
|
||||
{
|
||||
|
|
Binary file not shown.
|
@ -627,6 +627,9 @@ void STS_WS_sensor_read(sts_ws_sensor_data_t *sts_ws_sensor_data)
|
|||
sts_ws_sensor_data->weight_g = sts_weight_scale_value_g;
|
||||
sts_ws_sensor_data->tare_g = sts_weight_tare_g;
|
||||
|
||||
// sts_ws_sensor_data->weight_g = sts_weight_scale_value_g;
|
||||
// sts_ws_sensor_data->tare_g = sts_weight_tare_g;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue