# HG changeset patch # User Mychaela Falconia # Date 1620024689 0 # Node ID 96784b8974ebdac018933d5327f9b1023235fd53 # Parent 35474f3a17824ec6a3674f50f3149d108d811fb8 Switch_ON(): detect charging mode by CHGPRES bit Consider the following scenario: the phone is on, the user plugs in the charger, and then executes the power-off operation. In the Iota VRPC this sequence translates to a switch-off immediately followed by another switch-on - but the CHGSTS bit doesn't get set on the second switch-on cycle! Disassembly of Pirelli's fw shows that they check the CHGPRES bit, and furthermore, if both CHGPRES and ONBSTS are set, the code they pass to their modified Power_ON_Button() function is the one for charging - so let's adopt the same CHGPRES check and the same priority order for switch-on causes. diff -r 35474f3a1782 -r 96784b8974eb src/cs/drivers/drv_app/power/board/power.c --- a/src/cs/drivers/drv_app/power/board/power.c Mon May 03 04:43:06 2021 +0000 +++ b/src/cs/drivers/drv_app/power/board/power.c Mon May 03 06:51:29 2021 +0000 @@ -118,23 +118,7 @@ *******************************************************************************/ void Switch_ON(void) { - if (Power_abb_status & ONBSTS) - { - /* Switch on Condition on ON BUTTON Push */ - rvf_send_trace("Push Button from OFF to ON",26, NULL_PARAM, - RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID); - Power_ON_Button(); - } - - else if (Power_abb_status & ONRSTS) - { - /* Switch on Condition on ON REM transition 0->1 */ - rvf_send_trace("ON Remote",9, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, - LCC_USE_ID); - Power_ON_Remote(); - } - - else if (Power_abb_status & CHGSTS) + if (Power_abb_status & CHGPRES) { /* Switch on Condition on CHARGER IC PLUG */ rvf_send_trace("Boot: Charger Plug",18, NULL_PARAM, @@ -144,6 +128,14 @@ #endif } + else if (Power_abb_status & ONBSTS) + { + /* Switch on Condition on ON BUTTON Push */ + rvf_send_trace("Push Button from OFF to ON",26, NULL_PARAM, + RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID); + Power_ON_Button(); + } + else { /* In FreeCalypso start from reset is NOT the same as PWON! */