summaryrefslogtreecommitdiff
path: root/nuttx/drivers/pm/pm_activity.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-09-05 14:58:36 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-09-05 14:58:36 +0000
commitca6a50135e04d530ddf75b38f7fff1081ced6de4 (patch)
tree3e59d2e6776862931fbc1a6d0b9418613bac8e40 /nuttx/drivers/pm/pm_activity.c
parent0233d0342900484f1f70d5f95473d9ed262b843f (diff)
downloadpx4-nuttx-ca6a50135e04d530ddf75b38f7fff1081ced6de4.tar.gz
px4-nuttx-ca6a50135e04d530ddf75b38f7fff1081ced6de4.tar.bz2
px4-nuttx-ca6a50135e04d530ddf75b38f7fff1081ced6de4.zip
PM.. Allow negative coeffients; support revert to normal state
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3939 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/pm/pm_activity.c')
-rw-r--r--nuttx/drivers/pm/pm_activity.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/nuttx/drivers/pm/pm_activity.c b/nuttx/drivers/pm/pm_activity.c
index a0bae76fa..dd908b949 100644
--- a/nuttx/drivers/pm/pm_activity.c
+++ b/nuttx/drivers/pm/pm_activity.c
@@ -120,14 +120,14 @@ void pm_activity(int priority)
/* Make sure that we do not overflow the underlying uint16_t representation */
- if (accum > UINT16_MAX)
+ if (accum > INT16_MAX)
{
- accum = UINT16_MAX;
+ accum = INT16_MAX;
}
/* Save the updated count */
- g_pmglobals.accum = accum;
+ g_pmglobals.accum = (int16_t)accum;
/* Check the elapsed time. In periods of low activity, time slicing is
* controlled by IDLE loop polling; in periods of higher activity, time
@@ -140,7 +140,7 @@ void pm_activity(int priority)
now = clock_systimer();
if (now - g_pmglobals.stime >= TIME_SLICE_TICKS)
{
- uint16_t tmp;
+ int16_t tmp;
/* Sample the count, reset the time and count, and assess the PM
* state. This is an atomic operation because interrupts are