Exemple #1
0
bool GW_GameEngine_VTech::do_setmode(int mode)
{
    switch (mode)
    {
    case MODE_OFF:
        data_stopalltimers();
        data_stopallsounds();
        data_hideall(true);
        break;
    case MODE_IDLE:
        data_stopalltimers();
        data_showall();
        // reset numbers
        display_number(1, 8, false);
        display_number(2, 8, false);
        display_number(3, 8, false);
        display_number(4, 8, false);
        gameover_=true;
        break;
    case MODE_GAMEA:
    case MODE_GAMEB:
        if ((GetMode()!=MODE_GAMEA&&GetMode()!=MODE_GAMEB)||gameover_)
            do_game_start(mode);
        break;
    case MODE_TIME1:
        data_stopalltimers();
        data_hideall(true);
        data().position_get(PS_TIME1)->show();
        clock_update(mode);
        break;
    case MODE_TIME2:
        data_stopalltimers();
        data_hideall(true);
        data().position_get(PS_TIME2)->show();
        clock_update(mode);
        break;
    case MODE_ALARM:
        data_stopalltimers();
        data_hideall(true);
        data().position_get(PS_ALARM)->show();
        clock_update(mode);
        break;
    case MODE_CHRONO:
        data_stopalltimers();
        data_hideall(true);
        data().position_get(PS_CHRONO)->show();
        clock_update(mode);
        break;
    case MODE_DATE:
        data_stopalltimers();
        data_hideall(true);
        data().position_get(PS_DATE)->show();
        clock_update(mode);
        break;
    default:
        return false;
        break;
    }
    return true;
}
Exemple #2
0
int main(void) {
  init();
  alarm_init();
  clock_init();
  display_init();

  sei();

  for(;;) {
    clock_update();
    buttons_update();

    handle_buttons();
    handle_display();
    handle_led();

    buttons_age();
    clock_ticked = false;

    // Check display timeout
    if (mode != mode_off || status != status_none || !clock_set) { // Need the main clock
      set_sleep_mode(SLEEP_MODE_IDLE);
    } else {
      set_sleep_mode(SLEEP_MODE_PWR_SAVE);
    }
    sleep_enable();
    sleep_cpu();
    sleep_disable();
  }
}
Exemple #3
0
int main(void)
{
  uart_init();
  shift_init();
  timer_init();
  display_init();
  keypad_init();
  serial_init();
  edit_init();
  clock_init();
  watchdog_init(WDTO_15MS, &oops);

  sei();  // enable interrupts

  printf("\r\n*** BOOTED ***\r\nSpaceTime, yay!\r\n");

  timer_beep(10);

  while(1)
  {
    display_update();

    serial_update();

    edit_update();

    clock_update();
  }
}
Exemple #4
0
void h8_sci_device::device_reset()
{
	rdr = 0x00;
	tdr = 0xff;
	smr = 0x00;
	scr = 0x00;
	ssr = 0x84;
	brr = 0xff;
	rsr = 0x00;
	tsr = 0xff;
	rx_bit = 0;
	tx_bit = 0;
	tx_state = ST_IDLE;
	rx_state = ST_IDLE;
	clock_state = 0;
	clock_mode = CLKM_INTERNAL_ASYNC;
	clock_base = 0;
	clock_update();
	clock_value = true;
	ext_clock_value = true;
	ext_clock_counter = 0;
	rx_value = true;
	clk_cb(clock_value);
	tx_cb(1);
	cur_sync_time = attotime::never;
}
int
main(void)
{
	/* Set up the libevent library. */
	event_init();

	/* Set up the PubNub library, with a single shared context,
	 * using the libevent backend for event handling. */
	struct pubnub *p = pubnub_init("demo", "demo", &pubnub_libevent_callbacks, pubnub_libevent_init());

	/* Set the clock update timer. */
	evtimer_set(&clock_update_timer, clock_update, NULL);
	clock_update(-1, EV_TIMEOUT, NULL);

	/* First step in the PubNub call sequence is publishing a message. */
	publish(p);

	/* Here, we could start any other asynchronous operations as needed,
	 * launch a GUI or whatever. */

	/* Start the event loop. */
	event_dispatch();

	/* We should never reach here. */
	pubnub_done(p);
	return EXIT_SUCCESS;
}
static void
clock_cb(struct ev_loop *loop, ev_periodic *w, int revents)
{
  (void) loop;
  (void) revents;
  ClockInfo *info = (ClockInfo *) w->data;
  clock_update(info);
}
Exemple #7
0
bool GW_Game_DKong::do_setmode(int mode)
{
    switch (mode)
    {
    case MODE_OFF:
        data_stopalltimers();
        data_stopallsounds();
        data_hideall(true);
        break;
    case MODE_IDLE:
        data_stopalltimers();
        data_showall();
        // reset numbers
        display_number(1, 1, false);
        display_number(2, 2, false);
        display_number(3, 0, false);
        display_number(4, 0, false);
        break;
    case MODE_GAMEA:
    case MODE_GAMEB:
/*
        if ((GetMode()!=MODE_GAMEA&&GetMode()!=MODE_GAMEB))
            do_game_start(mode);
*/
        break;
    case MODE_TIME:
        data_stopalltimers();
        data_hideall(true);
        //data().position_get(PS_TIME1)->show();
        clock_update(mode);
        break;
    case MODE_ALARM:
        data_stopalltimers();
        data_hideall(true);
        data().position_get(PS_ALARM)->show();
        clock_update(mode);
        break;
    default:
        return false;
        break;
    }
    return true;
}
Exemple #8
0
/*-----------------------------------------------------------------------------------*/
void
main(void)
{
  struct ethernet_config *ethernet_config;

#if WITH_REBOOT
  rebootafterexit();
#endif /* WITH_REBOOT */

  videomode(VIDEOMODE_80COL);

  process_init();

#if 1
  ethernet_config = config_read("contiki.cfg");
#else
  {
    static struct ethernet_config config = {0xC0B0, "cs8900a.eth"};
    uip_ipaddr_t addr;

    uip_ipaddr(&addr, 192,168,0,128);
    uip_sethostaddr(&addr);

    uip_ipaddr(&addr, 255,255,255,0);
    uip_setnetmask(&addr);

    uip_ipaddr(&addr, 192,168,0,1);
    uip_setdraddr(&addr);

    uip_ipaddr(&addr, 192,168,0,1);
    resolv_conf(&addr);

    ethernet_config = &config;
  }
#endif

  procinit_init();

  process_start((struct process *)&ethernet_process, (char *)ethernet_config);

  autostart_start(autostart_processes);

  log_message("Contiki up and running ...", "");
  
  while(1) {

    process_run();

    etimer_request_poll();

    clock_update();
  }
}
Exemple #9
0
/*
 * Notify all modules that we're back on and rely on them to restore clocks
 * and power domains as required.
 */
static void
wake_up(void)
{
  lpm_registered_module_t *module;

  /* Remember IRQ energest for next pass */
  ENERGEST_IRQ_SAVE(irq_energest);
  ENERGEST_ON(ENERGEST_TYPE_CPU);
  ENERGEST_OFF(ENERGEST_TYPE_LPM);

  /* Sync so that we get the latest values before adjusting recharge settings */
  ti_lib_sys_ctrl_aon_sync();

  /* Adjust recharge settings */
  ti_lib_sys_ctrl_adjust_recharge_after_power_down();

  /*
   * Release the request to the uLDO
   * This is likely not required, since the switch to GLDO/DCDC is automatic
   * when coming back from deep sleep
   */
  ti_lib_prcm_mcu_uldo_configure(false);

  /* Turn on cache again */
  ti_lib_vims_mode_set(VIMS_BASE, VIMS_MODE_ENABLED);
  ti_lib_prcm_cache_retention_enable();

  ti_lib_aon_ioc_freeze_disable();
  ti_lib_sys_ctrl_aon_sync();

  /* Check operating conditions, optimally choose DCDC versus GLDO */
  ti_lib_sys_ctrl_dcdc_voltage_conditional_control();

  /*
   * We may or may not have been woken up by an AON RTC tick. If not, we need
   * to adjust our software tick counter
   */
  clock_update();

  watchdog_periodic();

  /* Notify all registered modules that we've just woken up */
  for(module = list_head(modules_list); module != NULL;
      module = module->next) {
    if(module->wakeup) {
      module->wakeup();
    }
  }
}
/* The AON RTC interrupt handler */
void
cc26xx_rtc_isr(void)
{
  ENERGEST_ON(ENERGEST_TYPE_IRQ);

  if(ti_lib_aon_rtc_event_get(AON_RTC_CH0)) {
    ti_lib_aon_rtc_event_clear(AON_RTC_CH0);
    rtimer_run_next();
  }

  if(ti_lib_aon_rtc_event_get(AON_RTC_CH2)) {
    ti_lib_aon_rtc_event_clear(AON_RTC_CH2);
    clock_update();
  }

  ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
// TODO: How to close off the things?
// Pass them through?
void add_callbacks(Bar * const bar, FILE *in, FILE *out)
{
  bspwm_watcher.data = &bar->bspwm;
  ev_io_init(&bspwm_watcher, bspwm_cb, fileno(in), EV_READ);

  wifi_timer.data = &bar->wifi;
  ev_init(&wifi_timer, wifi_cb);
  wifi_timer.repeat = 3.;

  battery_watcher.data = &bar->battery;
  ev_init(&battery_watcher, battery_cb);
  battery_watcher.repeat = 1.;

  sound_watcher.data = &bar->sound;
  ev_init(&sound_watcher, sound_cb);
  sound_watcher.repeat = 1.;

  packages_io_watcher.data = &bar->packages;
  FILE *packages_file = get_packages_file();
  ev_io_init(&packages_io_watcher, packages_io_cb, fileno(packages_file), EV_READ);
  ev_init(&packages_timer, packages_cb);
  packages_timer.repeat = 5 * 60.;

  // include an offset so that we don't get the time before it changes.
  // TODO Maybe separate into date watcher and time watcher?
  clock_update(&bar->clock);
  clock_watcher.data = &bar->clock;
  ev_periodic_init(&clock_watcher, clock_cb, 1., 60., 0);

  // Easy way to shut down.
  signal_watcher.data = bar;
  ev_signal_init(&signal_watcher, shutdown_cb, SIGINT);

  // An ev prepare runs before ev_run collects events;
  // in other words, it's (almost) like it's after all the events that have been called.
  // So we add an update

  out_fp = out;
  prepare_display.data = bar;
  ev_prepare_init(&prepare_display, display_cb);

}
Exemple #12
0
int
kernel_main (void) {

	//attach stdin and stdout
	serial_startup();

	printf("*****************************************\n");
	printf("kernel_main()\n");

	//any setup functions that need to be called?
	timer_setup();

	/* The main processing loop */
	while (1) {
		serial_poll();
		clock_update();
		time_update();
		
		if (task_spin() < 0) {
			//print_func("task error. Restarting\n");
		}
	}
}
Exemple #13
0
int main(int argc, char **argv)
{
        char* command = "update";

        parse_arguments(argc, argv);

        if (optind < argc) 
                command = argv[optind++];

        sensorbox_t* box = new_sensorbox(_home_dir, _config_file, _log_file);
        if (box == NULL) 
                exit(1);

        if (_test) 
                sensorbox_test_run(box);

        if (strcmp(command, "update") == 0) {

                if (sensorbox_lock(box) != 0) {
                        log_warn("Another process is already active. Exiting.");
                        delete_sensorbox(box);
                        exit(1);
                } 

                log_debug("Main: starting update ---------------------------------");

                if (sensorbox_init(box) != 0)
                        goto error_recovery;

                sensorbox_bring_network_up_maybe(box);                

                sensorbox_init_time(box);

                /* Check whether the definitions of the datastream are
                   up-to-date. */
                if (sensorbox_check_osd_definitions(box) != 0) {
                        if (sensorbox_bring_network_up(box) == 0)
                                sensorbox_create_osd_definitions(box);
                }

                /* Check whether the active sensors on the Arduino are
                   up-to-date. */
                sensorbox_check_sensors(box);

                /* Handle all data and camera events. */
                sensorbox_handle_events(box);

                /* Upload what ever data we have. */
                sensorbox_upload_data(box);
                sensorbox_upload_photos(box);
                sensorbox_upload_status(box); // Only runs if network is up

                /* Bring the network down, if not needed (particularly
                   GSM). */
                sensorbox_bring_network_down_maybe(box);

                /* Power of the RPi if in energy saving mode. */
                sensorbox_poweroff_maybe(box);

                //clock_update(box);
                log_debug("Main: update finished ---------------------------------");

                sensorbox_unlock(box);


        } else if (strcmp(command, "upload-data") == 0) {


                if (sensorbox_lock(box) != 0) {
                        log_warn("Another process is already active. Exiting.");
                        delete_sensorbox(box);
                        exit(1);
                } 

                if (sensorbox_init(box) != 0)
                        goto error_recovery;
                sensorbox_upload_data(box);

                sensorbox_unlock(box);

        } else if (strcmp(command, "upload-photos") == 0) {


                if (sensorbox_lock(box) != 0) {
                        log_warn("Another process is already active. Exiting.");
                        delete_sensorbox(box);
                        exit(1);
                } 

                if (sensorbox_init(box) != 0)
                        goto error_recovery;
                sensorbox_upload_photos(box);

                sensorbox_unlock(box);

        } else if (strcmp(command, "list-events") == 0) {
                if (sensorbox_init(box) != 0)
                        goto error_recovery;
                sensorbox_print_events(box);

        } else if (strcmp(command, "grab-image") == 0) {

                if (sensorbox_lock(box) != 0) {
                        log_warn("Another process is already active. Exiting.");
                        delete_sensorbox(box);
                        exit(1);
                } 

                if (sensorbox_init(box) != 0)
                        goto error_recovery;
                if (_output_file == NULL) {
                        log_err("grab-image: missing filename to store the output (use -o <filename>).");
                        goto error_recovery;
                }
                sensorbox_grab_image(box, _output_file);

                sensorbox_unlock(box);

        } else if (strcmp(command, "camera") == 0) {

                if (sensorbox_lock(box) != 0) {
                        log_warn("Another process is already active. Exiting.");
                        delete_sensorbox(box);
                        exit(1);
                } 

                time_t t;
                if (sensorbox_init(box) != 0)
                        goto error_recovery;
                if (sensorbox_get_time(box, &t) == 0)
                        sensorbox_update_camera(box, t);

                sensorbox_unlock(box);

        } else if (strcmp(command, "store-data") == 0) {

                if (sensorbox_lock(box) != 0) {
                        log_warn("Another process is already active. Exiting.");
                        delete_sensorbox(box);
                        exit(1);
                } 

                if (sensorbox_init(box) != 0)
                        goto error_recovery;
                sensorbox_store_sensor_data(box, _output_file);

                sensorbox_unlock(box);

        } else if (strcmp(command, "update-clock") == 0) {

                if (sensorbox_lock(box) != 0) {
                        log_warn("Another process is already active. Exiting.");
                        delete_sensorbox(box);
                        exit(1);
                } 

                if (sensorbox_init(box) != 0)
                        goto error_recovery;
                clock_update(box);

                sensorbox_unlock(box);

        } else if (strcmp(command, "set-time") == 0) {

                if (sensorbox_lock(box) != 0) {
                        log_warn("Another process is already active. Exiting.");
                        delete_sensorbox(box);
                        exit(1);
                } 

                if (sensorbox_init(box) != 0)
                        goto error_recovery;
                //clock_set(box);
                time_t m = time(NULL);
                sensorbox_set_time(box, m); 

                sensorbox_unlock(box);

        } else if (strcmp(command, "get-time") == 0) {
                time_t m;

                if (sensorbox_lock(box) != 0) {
                        log_warn("Another process is already active. Exiting.");
                        delete_sensorbox(box);
                        exit(1);
                } 

                if (sensorbox_init(box) != 0)
                        goto error_recovery;
                int err = sensorbox_get_time(box, &m); 
                if (!err) 
                        printf("%lu\n", (unsigned long) m);

                sensorbox_unlock(box);
                
        } else if (strcmp(command, "ifup") == 0) {

                if (sensorbox_lock(box) != 0) {
                        log_warn("Another process is already active. Exiting.");
                        delete_sensorbox(box);
                        exit(1);
                } 
                sensorbox_bring_network_up(box);

                sensorbox_unlock(box);

        } else if (strcmp(command, "merge") == 0) {

                if (sensorbox_lock(box) != 0) {
                        log_warn("Another process is already active. Exiting.");
                        delete_sensorbox(box);
                        exit(1);
                } 
                if (optind < argc) {
                        const char* filename = argv[optind++];
                        sensorbox_merge_config(box, filename);
                } else {
                        usage(stderr, argc, argv);                        
                }

                sensorbox_unlock(box);

        } else if (strcmp(command, "osd") == 0) {
                if (sensorbox_init(box) != 0)
                        goto error_recovery;
                sensorbox_create_osd_definitions(box);

        } else if (strcmp(command, "measure") == 0) {

                if (sensorbox_lock(box) != 0) {
                        log_warn("Another process is already active. Exiting.");
                        delete_sensorbox(box);
                        exit(1);
                } 
                if (sensorbox_init(box) != 0)
                        goto error_recovery;
                sensorbox_measure(box);

                sensorbox_unlock(box);

                /* } else if (strcmp(command, "status") == 0) { */
                /*         status_t status; */
                /*         sensorbox_get_status(box, &status); */

        } else if (strcmp(command, "reset-stack") == 0) {

                if (sensorbox_lock(box) != 0) {
                        log_warn("Another process is already active. Exiting.");
                        delete_sensorbox(box);
                        exit(1);
                } 
                if (sensorbox_init(box) != 0)
                        goto error_recovery;
                sensorbox_reset_stack(box);

                sensorbox_unlock(box);

        } else if (strcmp(command, "config-get") == 0) {
                if (optind < argc) {
                        const char* key = argv[optind++];
                        const char* value = sensorbox_config_getstr(box, key);
                        if (value != NULL)
                                printf("%s\n", value);
                        else printf("\n");
                }

        } else if (strcmp(command, "generate-system-files") == 0) {
                sensorbox_generate_system_files(box);                

        } else if (strcmp(command, "system-init") == 0) {
                sensorbox_generate_system_files(box);                
                sensorbox_bring_network_up_maybe(box);                

        } else if (strcmp(command, "upload-status") == 0) {

                if (sensorbox_lock(box) != 0) {
                        log_warn("Another process is already active. Exiting.");
                        delete_sensorbox(box);
                        exit(1);
                } 
                sensorbox_upload_status(box);

                sensorbox_unlock(box);

        } else {
                usage(stderr, argc, argv);
        }


        delete_sensorbox(box);
        exit(0);

 error_recovery:
        sensorbox_unlock(box);
        delete_sensorbox(box);
        exit(1);
}
Exemple #14
0
void GW_GameEngine_VTech::do_update()
{
    if (GetMode()==MODE_TIME1 || GetMode()==MODE_TIME2 || GetMode()==MODE_ALARM || GetMode()==MODE_DATE)
        clock_update();
}
Exemple #15
0
void GW_Game_DKong::do_update()
{
    if (GetMode()==MODE_TIME)
        clock_update();
}
Exemple #16
0
/**
 * Validate a base64-encoded version token `tokenb64' of `len' bytes.
 * The `ip' is given only for clock update operations.
 *
 * @returns error code, or TOK_OK if token is valid.
 */
tok_error_t
tok_version_valid(
	const char *version, const char *tokenb64, int len, host_addr_t addr)
{
	time_t now = tm_time();
	time_t stamp;
	uint32 crc;
	const struct tokkey *tk;
	const struct tokkey *rtk;
	const struct tokkey *latest;
	uint idx;
	const char *key;
	SHA1Context ctx;
	char lvldigest[1024];
	char token[TOKEN_VERSION_SIZE];
	struct sha1 digest;
	version_t rver;
	char *end;
	int toklen;
	int lvllen;
	int lvlsize;
	uint i;

	end = strchr(tokenb64, ';');		/* After 25/02/2003 */
	toklen = end ? (end - tokenb64) : len;

	/*
	 * Verify token.
	 */

	if (toklen != TOKEN_BASE64_SIZE)
		return TOK_BAD_LENGTH;

	if (!base64_decode_into(tokenb64, toklen, token, TOKEN_VERSION_SIZE))
		return TOK_BAD_ENCODING;

	stamp = (time_t) peek_be32(&token);

	/*
	 * Use that stamp, whose precision is TOKEN_LIFE, to update our
	 * clock skew if necessary.
	 */

	clock_update(stamp, TOKEN_LIFE, addr);

	if (ABS(stamp - clock_loc2gmt(now)) > TOKEN_CLOCK_SKEW)
		return TOK_BAD_STAMP;

	if (!version_fill(version, &rver))		/* Remote version */
		return TOK_BAD_VERSION;

	tk = find_tokkey_version(&rver, stamp);	/* The keys they used */
	if (tk == NULL)
		return TOK_BAD_KEYS;

	idx = (uchar) token[6] & 0x1f;			/* 5 bits for the index */
	if (idx >= tk->count)
		return TOK_BAD_INDEX;

	key = tk->keys[idx];

	SHA1Reset(&ctx);
	SHA1Input(&ctx, key, strlen(key));
	SHA1Input(&ctx, token, 7);
	SHA1Input(&ctx, version, strlen(version));
	SHA1Result(&ctx, &digest);

	if (0 != memcmp(&token[7], digest.data, SHA1_RAW_SIZE))
		return TOK_INVALID;

	if (version_build_cmp(&rver, &tk->ver) < 0)
		return TOK_OLD_VERSION;

	if (end == NULL)
		return TOK_MISSING_LEVEL;

	latest = find_latest(&rver);
	if (latest == NULL)						/* Unknown in our key set */
		return TOK_OLD_VERSION;

	/*
	 * Verify build.
	 *
	 * Build numbers were emitted when we switched to SVN on 2006-08-26
	 * and stopped being a monotonous increasing function when we switched
	 * to git on 2011-09-11.
	 */

	if (
		rver.timestamp >= 1156543200 &&		/* 2006-08-26 */
		rver.timestamp < GIT_SWITCH			/* 2011-09-11 */
	) {
		if (0 == rver.build)
			return TOK_MISSING_BUILD;
		if (rver.build < latest->ver.build)
			return TOK_WRONG_BUILD;
	}

	/*
	 * Verify level.
	 */

	lvllen = len - toklen - 2;				/* Forget about "; " */
	end += 2;								/* Skip "; " */

	if (UNSIGNED(lvllen) >= sizeof(lvldigest) || lvllen <= 0)
		return TOK_BAD_LEVEL_LENGTH;

	if (lvllen & 0x3)
		return TOK_BAD_LEVEL_LENGTH;

	lvllen = base64_decode_into(end, lvllen, lvldigest, sizeof(lvldigest));

	if (lvllen == 0 || (lvllen & 0x1))
		return TOK_BAD_LEVEL_ENCODING;

	g_assert(lvllen >= 2);
	g_assert((lvllen & 0x1) == 0);

	/*
	 * Only check the highest keys we can check.
	 */

	lvllen /= 2;							/* # of keys held remotely */
	lvlsize = G_N_ELEMENTS(token_keys) - (tk - token_keys);
	lvlsize = MIN(lvllen, lvlsize);

	g_assert(lvlsize >= 1);

	rtk = tk + (lvlsize - 1);				/* Keys at that level */

	crc = crc32_update(0, token, TOKEN_VERSION_SIZE);
	crc = tok_crc(crc, rtk);

	lvlsize--;								/* Move to 0-based offset */

	if (peek_be16(&lvldigest[2*lvlsize]) != crc)
		return TOK_INVALID_LEVEL;

	for (i = 0; i < G_N_ELEMENTS(token_keys); i++) {
		rtk = &token_keys[i];
		if (rtk->ver.timestamp > rver.timestamp) {
			rtk--;							/* `rtk' could not exist remotely */
			break;
		}
	}

	if (lvlsize < rtk - tk)
		return TOK_SHORT_LEVEL;

	return TOK_OK;
}
void loop() {

    clock_update();

    if(pulse_100ms){

        main_prev_millis=millis();

        main_period_actual=millis()-main_period_prev_millis;
        main_period_prev_millis=millis();

        if(main_period_actual>main_period_max)
            main_period_max=main_period_actual;

        //~ Serial.print("1");
        /* recupere les valeurs des cartes d'entrees si changement détecté*/

        if(NumberOfBoardIn4Dimmer4 && !digitalRead(int_i2c))
            BoardIn4Dimmer4_pre();

        if(NumberOfBoardIn16 && !digitalRead(int_i2c))
            BoardIn16_pre();

        if(NumberOfBoardIn8R8 && !digitalRead(int_i2c))
            BoardIn8R8_pre();

		if(NumberOfRFDevice)
            RFDevice_pre();  

        /* update all the preliminary condition */
        pre_update();  // cf custom.ino

        scenario(); // cf custom.ino


        /* update the status of the shutters */
        if (NumberOfShutter)
            shutter_post();

        /* update the post conditions */
        post_update(); // cf custom.ino

        /* update the output of the boards */
        if(NumberOfBoardIn4Dimmer4)
            BoardIn4Dimmer4_post();

        if(NumberOfBoardR8)
            BoardR8_post();

        if(NumberOfBoardIn8R8)
            BoardIn8R8_post();

		if(NumberOfRFDevice)
            RFDevice_post(); 

        main_actual=millis()-main_prev_millis;
        if(main_actual>main_max)
            main_max=main_actual;


    digitalWrite(STATUS_LED, LOW);
/**/


   }

    other_prev_millis=millis();


    if(pulse_1000ms){

        hbeat++;

        RTC.getTime(); /// update time should be every 500ms or 1s

        if(NumberOfBoardIn4Dimmer4)
            BoardIn4Dimmer4_hbeat();

        if(NumberOfBoardIn8R8)
            BoardIn8R8_hbeat();

        if(NumberOfBoardIn16)
            BoardIn16_hbeat();

        if(NumberOfBoardR8)
            BoardR8_hbeat();


        #ifdef WITH_LIGHTING
        if (NumberOfLighting)
            lighting_hard_status();
        #endif
        //~ Serial.print("1");
        if(NumberOfShutter)
            shutter_hard_status();
        //~ Serial.print("2");
        if(NumberOfTemp){
            //~ Serial.print("3");
         Read_DS2482_Temp(true); //lecture des temperature sur les sodes OneWire en mode seconde
        }
        temperature_sendXPL(); /// temporaire

        TeleInfo.read();

    }

    if(pulse_1mn){

        if(minutes == 59){
            minutes =0;
            heure++;
        }else{
            minutes++;
        }

        TeleInfoSendXPL();  //envois de toutes les trame OneWire en XPL

    }

    loop_Udp();

    runBitlash();

    other_actual=millis()-other_prev_millis;
    //~ other_prev_millis=millis();

    if(other_actual>other_max)
        other_max=other_actual;

}
Exemple #18
0
static void all_clocks_update(void) {
   clock_update(CLOCK_REALTIME,  &clock_real, "realtime");
   clock_update(CLOCK_MONOTONIC, &clock_mono, "monotonic");
}