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 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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> #include <signal.h>
@ -140,7 +140,7 @@ main(int argc, char **argv)
#endif /* WITH_UIP */ #endif /* WITH_UIP */
/* printf("Starting %s " */ /* 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); leds_on(LEDS_GREEN);
ds2411_init(); ds2411_init();
sensors_light_init(); sensors_light_init();
@ -205,17 +205,18 @@ main(int argc, char **argv)
button_sensor.activate(); button_sensor.activate();
energest_init();
ENERGEST_ON(ENERGEST_TYPE_CPU);
/* printf("Autostarting processes\n"); */ /* printf("Autostarting processes\n"); */
print_processes((struct process **) autostart_processes); print_processes((struct process **) autostart_processes);
autostart_start((struct process **) autostart_processes); autostart_start((struct process **) autostart_processes);
energest_init();
/* /*
* This is the scheduler loop. * This is the scheduler loop.
*/ */
printf("process_run()...\n"); printf("process_run()...\n");
ENERGEST_ON(ENERGEST_TYPE_CPU);
watchdog_start(); watchdog_start();
while (1) { while (1) {
int r; int r;