Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Power saving mode for Ends #6

Merged
merged 2 commits into from
Dec 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CC2530DB/GenericApp.ewp
Original file line number Diff line number Diff line change
Expand Up @@ -1447,6 +1447,7 @@
<option>
<name>CCDefines</name>
<state>HAL_BOARD_TARGET</state>
<state>POWER_SAVING</state>
</option>
<option>
<name>CCPreprocFile</name>
Expand Down Expand Up @@ -3731,6 +3732,7 @@
<state>HAL_BOARD_TARGET</state>
<state>HAL_PA_LNA_CC2592</state>
<state>APP_TX_POWER=19</state>
<state>POWER_SAVING</state>
</option>
<option>
<name>CCPreprocFile</name>
Expand Down Expand Up @@ -6017,6 +6019,7 @@
<state>HAL_BOARD_TARGET</state>
<state>HAL_PA_LNA</state>
<state>APP_TX_POWER=19</state>
<state>POWER_SAVING</state>
</option>
<option>
<name>CCPreprocFile</name>
Expand Down
7 changes: 5 additions & 2 deletions Source/zcl_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ static void zclApp_InitCO2Uart(void) {
halUARTConfig.callBackFunc = NULL;
HalUARTInit();
if (HalUARTOpen(CO2_UART_PORT, &halUARTConfig) == HAL_UART_SUCCESS) {
LREPMaster("Initialized sensair \r\n");
LREPMaster("Initialized CO2 UART \r\n");
}
}

Expand Down Expand Up @@ -228,7 +228,7 @@ static void zclApp_InitSensors(void) {
LREPMaster("Sensor type UNKNOWN\r\n");
break;
}

osal_pwrmgr_task_state(zclApp_TaskID, PWRMGR_CONSERVE);
}

static void zclApp_StopSensorDetection(void) {
Expand All @@ -238,6 +238,7 @@ static void zclApp_StopSensorDetection(void) {
static void zclApp_DetectSensorType(void) {
static uint8 currentSensorsReadingPhase = 0;
uint16 result = 0;
osal_pwrmgr_task_state(zclApp_TaskID, PWRMGR_HOLD);
if (sensorType == UNKNOWN) {
switch (currentSensorsReadingPhase++) {
case 0:
Expand Down Expand Up @@ -288,6 +289,7 @@ static void zclApp_ReadSensors(void) {
int16 temp;
switch (currentSensorsReadingPhase++) {
case 0:
osal_pwrmgr_task_state(zclApp_TaskID, PWRMGR_HOLD);
switch (sensorType) {
case SENSEAIR:
SenseAir_RequestMeasure();
Expand Down Expand Up @@ -332,6 +334,7 @@ static void zclApp_ReadSensors(void) {

case 4:
zclApp_ReadBME280(&bme_dev);
osal_pwrmgr_task_state(zclApp_TaskID, PWRMGR_CONSERVE);
break;

default:
Expand Down