Subversion Repositories HomeAutomation

Rev

Rev 1937 | Rev 1941 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1937 Rev 1938
Line 732... Line 732...
732
            break;
732
            break;
733
        }
733
        }
734
 
734
 
735
        case sns_irTransceive_STATE_START_TRANSMIT_PRONTO:
735
        case sns_irTransceive_STATE_START_TRANSMIT_PRONTO:
736
        {
736
        {
737
            /* Invalid once seq len? */
737
            /* Once sequence exists? */
738
            if (irTxChannel[channel].onceSeqLen<=0) {
738
            if (irTxChannel[channel].onceSeqLen>0) {
739
                /* Send error code. */
-
 
740
                pronto_sendResponse(channel, CAN_MODULE_ENUM_IRTRANSCEIVE_IRPRONTORESPONSE_RESPONSE_ABORTED);
-
 
741
 
-
 
742
                /* Enter idle state. */
-
 
743
                irTxChannel[channel].state = sns_irTransceive_STATE_IDLE;
-
 
744
                break;
-
 
745
            }
-
 
746
            /* Start IR transmission. */
739
                /* Start IR transmission of the once sequence. */
747
            if(IrTransceiver_Transmit(channel, irTxChannel[channel].txbuf, 0, irTxChannel[channel].onceSeqLen - 1, irTxChannel[channel].proto.modfreq) < 0) {
740
                if(IrTransceiver_Transmit(channel, irTxChannel[channel].txbuf, 0, irTxChannel[channel].onceSeqLen - 1, irTxChannel[channel].proto.modfreq) < 0) {
748
                /* Send error code. */
741
                    /* Send error code. */
749
                pronto_sendResponse(channel, CAN_MODULE_ENUM_IRTRANSCEIVE_IRPRONTORESPONSE_RESPONSE_ABORTED);
742
                    pronto_sendResponse(channel, CAN_MODULE_ENUM_IRTRANSCEIVE_IRPRONTORESPONSE_RESPONSE_ABORTED);
-
 
743
 
-
 
744
                    /* Enter idle state. */
-
 
745
                    irTxChannel[channel].state = sns_irTransceive_STATE_IDLE;
-
 
746
                    break;
-
 
747
                }
-
 
748
                else {
-
 
749
                    /* Enter transmitting state. */
-
 
750
                                irTxChannel[channel].sendingPronto = TRUE;
-
 
751
                                irTxChannel[channel].state = sns_irTransceive_STATE_TRANSMITTING;
-
 
752
                    break;
-
 
753
                }
-
 
754
            }
-
 
755
            /* Repeat sequence exists? */
-
 
756
            else if (irTxChannel[channel].repSeqLen>0) {
-
 
757
                /* Start IR transmission of the repeat sequence. */
-
 
758
                    if(IrTransceiver_Transmit(channel, irTxChannel[channel].txbuf, 0, irTxChannel[channel].repSeqLen - 1, irTxChannel[channel].proto.modfreq) < 0) {
-
 
759
                                        /* Send error code. */
-
 
760
                                        pronto_sendResponse(channel, CAN_MODULE_ENUM_IRTRANSCEIVE_IRPRONTORESPONSE_RESPONSE_ABORTED);
750
 
761
 
751
                /* Enter idle state. */
762
                                        /* Enter idle state. */
752
                irTxChannel[channel].state = sns_irTransceive_STATE_IDLE;
763
                                        irTxChannel[channel].state = sns_irTransceive_STATE_IDLE;
753
                break;
764
                                        break;
754
            }
765
                                }
755
 
766
                else {
756
            /* Enter transmitting state. */
767
                                        /* Enter transmitting state. */
757
            irTxChannel[channel].sendingPronto = TRUE;
768
                                        irTxChannel[channel].sendingPronto = TRUE;
758
            irTxChannel[channel].state = sns_irTransceive_STATE_TRANSMITTING;
769
                                        irTxChannel[channel].state = sns_irTransceive_STATE_TRANSMITTING;
759
            break;
770
                    break;
760
        }
771
                                }
-
 
772
            }
-
 
773
            /* Neither once sequence nor repeat sequence exists! */
-
 
774
            /* Send error code. */
-
 
775
                        pronto_sendResponse(channel, CAN_MODULE_ENUM_IRTRANSCEIVE_IRPRONTORESPONSE_RESPONSE_ABORTED);
-
 
776
                        /* Enter idle state. */
-
 
777
                        irTxChannel[channel].state = sns_irTransceive_STATE_IDLE;
-
 
778
                        break;
-
 
779
        }
761
 
780
 
762
        case sns_irTransceive_STATE_PRONTO_REPEAT:
781
        case sns_irTransceive_STATE_PRONTO_REPEAT:
763
        {
782
        {
764
            /* Check if done. */
783
            /* Check if done. */
765
            if ((irTxChannel[channel].repeatCount >= irTxChannel[channel].proto.repeats && irTxChannel[channel].proto.repeats != 0xFF) || irTxChannel[channel].stopSend) {
784
            if ((irTxChannel[channel].repeatCount >= irTxChannel[channel].proto.repeats && irTxChannel[channel].proto.repeats != 0xFF) || irTxChannel[channel].stopSend) {
766
                /* Pronto transmission was stopped/completed */
785
                /* Pronto transmission was stopped/completed */
Line 772... Line 791...
772
            if (irTxChannel[channel].repeatCount < 255) {
791
            if (irTxChannel[channel].repeatCount < 255) {
773
                irTxChannel[channel].repeatCount++;
792
                irTxChannel[channel].repeatCount++;
774
            }
793
            }
775
 
794
 
776
            /* Repeat sequence exists? */
795
            /* Repeat sequence exists? */
777
            if (irTxChannel[channel].repSeqLen != 0) {
796
            if (irTxChannel[channel].repSeqLen > 0) {
778
                /* Use repeat seq */
797
                /* Use repeat seq */
779
                uint16_t offset = ((uint16_t)irTxChannel[channel].onceSeqLen);
798
                uint16_t offset = ((uint16_t)irTxChannel[channel].onceSeqLen);
780
                /* Don't transmit last passive. last passive handled by timer */
799
                /* Don't transmit last passive. last passive handled by timer */
781
                IrTransceiver_Transmit(channel, irTxChannel[channel].txbuf, offset, ((uint16_t)irTxChannel[channel].repSeqLen) - 1, irTxChannel[channel].proto.modfreq);
800
                IrTransceiver_Transmit(channel, irTxChannel[channel].txbuf, offset, ((uint16_t)irTxChannel[channel].repSeqLen) - 1, irTxChannel[channel].proto.modfreq);
782
            }
801
            }
783
            else {
802
            /* Once sequence exists? */
-
 
803
            else if (irTxChannel[channel].onceSeqLen > 0) {
784
                /* Use once seq */
804
                /* Use once seq */
785
                /* Don't transmit last passive. last passive handled by timer */
805
                /* Don't transmit last passive. last passive handled by timer */
786
                IrTransceiver_Transmit(channel, irTxChannel[channel].txbuf, 0, irTxChannel[channel].txlen - 1, irTxChannel[channel].proto.modfreq);
806
                IrTransceiver_Transmit(channel, irTxChannel[channel].txbuf, 0, irTxChannel[channel].txlen - 1, irTxChannel[channel].proto.modfreq);
787
            }
807
            }
788
            irTxChannel[channel].state = sns_irTransceive_STATE_TRANSMITTING;
808
            irTxChannel[channel].state = sns_irTransceive_STATE_TRANSMITTING;