From b93715277e718cbe5abc7d9158b6144a8d57e9ec Mon Sep 17 00:00:00 2001 From: YunHorn Technology Date: Thu, 18 Apr 2024 19:13:16 +0800 Subject: [PATCH] rename predefine SOAL_LEVEL_SENSOR instead of SOAP_LEVEL --- Core/Inc/yunhorn_sts_prd_conf.h | 4 ++-- Core/Inc/yunhorn_sts_sensors.h | 2 +- Core/Src/gpio.c | 7 ++++++- Core/Src/yunhorn_sts_process.c | 6 +++--- LoRaWAN/App/lora_app.c | 10 +++++----- STM32CubeIDE/.cproject | 7 +++++++ STM32CubeIDE/.settings/language.settings.xml | 4 ++-- STM32CubeIDE/Release/makefile | 2 +- 8 files changed, 27 insertions(+), 15 deletions(-) diff --git a/Core/Inc/yunhorn_sts_prd_conf.h b/Core/Inc/yunhorn_sts_prd_conf.h index 6d5afa8..706238c 100644 --- a/Core/Inc/yunhorn_sts_prd_conf.h +++ b/Core/Inc/yunhorn_sts_prd_conf.h @@ -224,8 +224,8 @@ #define MajorVer 24U -#define MinorVer 03U -#define SubMinorVer 8U +#define MinorVer 04U +#define SubMinorVer 18U #define FirmwareVersion 3U #define YUNHORN_STS_MAX_NVM_CFG_SIZE 64U #define YUNHORN_STS_AC_CODE_SIZE 20U diff --git a/Core/Inc/yunhorn_sts_sensors.h b/Core/Inc/yunhorn_sts_sensors.h index e31f297..05e11a5 100644 --- a/Core/Inc/yunhorn_sts_sensors.h +++ b/Core/Inc/yunhorn_sts_sensors.h @@ -571,7 +571,7 @@ void STS_SENSOR_NVM_CFG(void); -#if defined(SOAP_LEVEL) +#if defined(SOAP_LEVEL_SENSOR) void YUNHORN_STS_R4_SENSOR_Read(STS_R0_SensorDataTypeDef *r4_data); void YUNHORN_STS_R4_SENSOR_Init(void); #endif diff --git a/Core/Src/gpio.c b/Core/Src/gpio.c index 6315f95..bb661d7 100644 --- a/Core/Src/gpio.c +++ b/Core/Src/gpio.c @@ -150,11 +150,16 @@ void MX_GPIO_Init(void) GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(LED1_GPIO_Port, &GPIO_InitStruct); + GPIO_InitStruct.Pin = MEMS_POWER_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + HAL_GPIO_Init(MEMS_POWER_GPIO_Port, &GPIO_InitStruct); /* ============== SOAP LEVEL DETECTION ========================= */ -#if defined(SOAP_LEVEL) +#if defined(SOAP_LEVEL_SENSOR) HAL_GPIO_WritePin(SOAP_SWITCH_GPIO_Port, SOAP_SWITCH_Pin, GPIO_PIN_RESET); diff --git a/Core/Src/yunhorn_sts_process.c b/Core/Src/yunhorn_sts_process.c index 6203d01..e6a2216 100644 --- a/Core/Src/yunhorn_sts_process.c +++ b/Core/Src/yunhorn_sts_process.c @@ -353,7 +353,7 @@ void STS_YunhornSTSEventP6_Process(void) LED_OFF; #endif /* 1. Sensor Power On */ -#if defined(SOAP_LEVEL) +#if defined(SOAP_LEVEL_SENSOR) HAL_GPIO_WritePin(SOAP_SWITCH_GPIO_Port, SOAP_SWITCH_Pin, GPIO_PIN_SET); HAL_Delay(1000); @@ -574,7 +574,7 @@ void STS_SENSOR_MEMS_Reset(uint8_t cnt) void YUNHORN_STS_R4_SENSOR_Read(STS_R0_SensorDataTypeDef *r4_data) { -#ifdef SOAP_LEVEL +#ifdef SOAP_LEVEL_SENSOR r4_data->on_off_event = (sts_soap_level_state==0x0)? 1:0; r4_data->measure_tech = 0x0; // capacity measure #endif @@ -592,7 +592,7 @@ void YUNHORN_STS_R4_SENSOR_Init(void) #if defined(YUNHORN_STS_R4_ENABLED) void STS_R0_SENSOR_Read(STS_R0_SensorDataTypeDef *r0_data) { -#ifdef SOAP_LEVEL +#ifdef SOAP_LEVEL_SENSOR r0_data->on_off_event = sts_soap_level_state; r0_data->measure_tech = 0; /* 0: capacit, 1:dTof, 2: ultrasonic */ #elif defined(TOF_1)||defined(TOF_2)||defined(TOF_3) diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index de3598e..1b233af 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -587,7 +587,7 @@ void LoRaWAN_Init(void) UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), UTIL_SEQ_RFU, STS_YunhornSTSEventP4_Process); #endif // UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP5), UTIL_SEQ_RFU, STS_YunhornSTSEventP5_Process); -#ifdef SOAP_LEVEL +#ifdef SOAP_LEVEL_SENSOR UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP6), UTIL_SEQ_RFU, STS_YunhornSTSEventP6_Process); #endif // UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP7), UTIL_SEQ_RFU, STS_YunhornSTSEventP7_Process); @@ -639,7 +639,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) switch (GPIO_Pin) { case BUT1_Pin: -#ifdef SOAP_LEVEL +#ifdef SOAP_LEVEL_SENSOR UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP6), CFG_SEQ_Prio_0); UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); #endif @@ -788,7 +788,7 @@ static void SendTxData(void) //uint16_t batteryLevelmV = SYS_GetBatteryLevel(); //sensor_t sensor_data; -#if defined(SOAP_LEVEL) +#if defined(SOAP_LEVEL_SENSOR) STS_R0_SensorDataTypeDef r4_data; #endif @@ -805,7 +805,7 @@ static void SendTxData(void) STS_O5_SENSOR_Read(&oo_data); #endif -#if defined(SOAP_LEVEL) +#if defined(SOAP_LEVEL_SENSOR) //STS_YunhornSTSEventP6_Process(); UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP6), CFG_SEQ_Prio_0); @@ -844,7 +844,7 @@ static void SendTxData(void) #if defined(STS_O5) AppData.Buffer[i++] = (uint8_t)(oo_data.state_sensor1_on_off)&0xff; -#elif defined(SOAP_LEVEL) +#elif defined(SOAP_LEVEL_SENSOR) AppData.Buffer[i++] = (uint8_t)(0x02); //length of the following value AppData.Buffer[i++] = (uint8_t)(r4_data.measure_tech)&0xff; //#11 AppData.Buffer[i++] = (uint8_t)(r4_data.on_off_event)&0xff; //#11 diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject index d83a788..e728a12 100644 --- a/STM32CubeIDE/.cproject +++ b/STM32CubeIDE/.cproject @@ -39,6 +39,7 @@