Flush energy estimates before reading them

This commit is contained in:
adamdunkels 2008-07-09 09:32:54 +00:00
parent f93f501a4d
commit a40791e6c4

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: shell-sky.c,v 1.9 2008/07/03 17:56:17 adamdunkels Exp $ * $Id: shell-sky.c,v 1.10 2008/07/09 09:32:54 adamdunkels Exp $
*/ */
/** /**
@ -269,6 +269,8 @@ PROCESS_THREAD(shell_power_process, ev, data)
PROCESS_BEGIN(); PROCESS_BEGIN();
energest_flush();
msg.len = 8; msg.len = 8;
msg.cpu = energest_type_time(ENERGEST_TYPE_CPU) - last_cpu; msg.cpu = energest_type_time(ENERGEST_TYPE_CPU) - last_cpu;
msg.lpm = energest_type_time(ENERGEST_TYPE_LPM) - last_lpm; msg.lpm = energest_type_time(ENERGEST_TYPE_LPM) - last_lpm;
@ -291,6 +293,8 @@ PROCESS_THREAD(shell_energy_process, ev, data)
PROCESS_BEGIN(); PROCESS_BEGIN();
energest_flush();
msg.len = 8; msg.len = 8;
msg.cpu = energest_type_time(ENERGEST_TYPE_CPU); msg.cpu = energest_type_time(ENERGEST_TYPE_CPU);
msg.lpm = energest_type_time(ENERGEST_TYPE_LPM); msg.lpm = energest_type_time(ENERGEST_TYPE_LPM);