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;

}
Ejemplo n.º 2
0
void loop(void) {
	runBitlash();
	runClock();
}