Moved energy estimation initialization before starting processes so that processes may turn things on and off without messing up the energy estimates

This commit is contained in:
adamdunkels 2007-11-28 14:45:22 +00:00
parent d6c597cf0b
commit 40d9045a2d

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)$Id: contiki-sky-main.c,v 1.16 2007/11/21 16:41:44 nifi Exp $
* @(#)$Id: contiki-sky-main.c,v 1.17 2007/11/28 14:45:22 adamdunkels Exp $
*/
#include <signal.h>
@ -140,7 +140,7 @@ main(int argc, char **argv)
#endif /* WITH_UIP */
/* printf("Starting %s " */
/* "($Id: contiki-sky-main.c,v 1.16 2007/11/21 16:41:44 nifi Exp $)\n", __FILE__); */
/* "($Id: contiki-sky-main.c,v 1.17 2007/11/28 14:45:22 adamdunkels Exp $)\n", __FILE__); */
leds_on(LEDS_GREEN);
ds2411_init();
sensors_light_init();
@ -204,18 +204,19 @@ main(int argc, char **argv)
#endif /* WITH_UIP */
button_sensor.activate();
energest_init();
ENERGEST_ON(ENERGEST_TYPE_CPU);
/* printf("Autostarting processes\n"); */
print_processes((struct process **) autostart_processes);
autostart_start((struct process **) autostart_processes);
energest_init();
/*
* This is the scheduler loop.
*/
printf("process_run()...\n");
ENERGEST_ON(ENERGEST_TYPE_CPU);
watchdog_start();
while (1) {
int r;