Subversion Repositories HomeAutomation

Rev

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

Rev 1922 Rev 1929
Line 989... Line 989...
989
    if (buf[2] < IR_NEXA2_START2 - IR_NEXA2_START2/IR_NEXA2_TOL_DIV && buf[2] > IR_NEXA2_START2 + IR_NEXA2_START2/IR_NEXA2_TOL_DIV) { //check start bit
989
    if (buf[2] < IR_NEXA2_START2 - IR_NEXA2_START2/IR_NEXA2_TOL_DIV && buf[2] > IR_NEXA2_START2 + IR_NEXA2_START2/IR_NEXA2_TOL_DIV) { //check start bit
990
        return IR_NOT_CORRECT_DATA;
990
        return IR_NOT_CORRECT_DATA;
991
    }
991
    }
992
 
992
 
993
    /* Incoming data could actually be longer than 32bits when a dimming command is received */
993
    /* Incoming data could actually be longer than 32bits when a dimming command is received */
994
    uint32_t rawbitsTemp = 0;
994
    uint64_t rawbitsTemp = 0;
995
    uint8_t bitCounter = 0;
995
    uint8_t bitCounter = 0;
996
    for (uint8_t i = 3; i < len; i++) {
996
    for (uint8_t i = 3; i < len; i++) {
997
        if ((i&1) == 0) {       /* if even, data */
997
        if ((i&1) == 0) {       /* if even, data */
998
            /* check length of transmit pulse */
998
            /* check length of transmit pulse */
999
            if (buf[i] > IR_NEXA2_LOW_ONE - IR_NEXA2_LOW_ONE/IR_NEXA2_TOL_DIV && buf[i] < IR_NEXA2_LOW_ONE + IR_NEXA2_LOW_ONE/IR_NEXA2_TOL_DIV) {
999
            if (buf[i] > IR_NEXA2_LOW_ONE - IR_NEXA2_LOW_ONE/IR_NEXA2_TOL_DIV && buf[i] < IR_NEXA2_LOW_ONE + IR_NEXA2_LOW_ONE/IR_NEXA2_TOL_DIV) {
Line 1033... Line 1033...
1033
 *      Pointer to protocol information
1033
 *      Pointer to protocol information
1034
 * @return
1034
 * @return
1035
 *      IR_OK if data expanded successfully, one of several errormessages if not
1035
 *      IR_OK if data expanded successfully, one of several errormessages if not
1036
 */
1036
 */
1037
int8_t expandNexa2(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto) {
1037
int8_t expandNexa2(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto) {
1038
    //buf[0] = IR_NEXA2_START1;
-
 
1039
    buf[0] = IR_NEXA2_HIGH;
1038
    buf[0] = IR_NEXA2_HIGH;
1040
    buf[1] = IR_NEXA2_START2;
1039
    buf[1] = IR_NEXA2_START2;
1041
 
1040
 
1042
    /* Start without support for dimmer */
1041
    /* Start without support for dimmer */
1043
    *len = 131;
1042
    *len = 131;
1044
   
-
 
1045
   
-
 
1046
   
1043
   
1047
    // TODO find out if dimmer value should be send, set different length, pad different
1044
    // TODO find out if dimmer value should be send, set different length, pad different
1048
   
1045
   
-
 
1046
    uint64_t tempshift = proto->data;
-
 
1047
    for (uint8_t i = 2; i < 131; i+=4)
-
 
1048
    {
-
 
1049
        buf[i] = IR_NEXA2_HIGH;
-
 
1050
        buf[i+2] = IR_NEXA2_HIGH;
-
 
1051
        if (tempshift&1) {
-
 
1052
            buf[i+1] = IR_NEXA2_LOW_ONE;
-
 
1053
            buf[i+3] = IR_NEXA2_LOW_ZERO;
-
 
1054
        } else {
-
 
1055
            buf[i+1] = IR_NEXA2_LOW_ZERO;
-
 
1056
            buf[i+3] = IR_NEXA2_LOW_ONE;
-
 
1057
        }
-
 
1058
        tempshift = tempshift>>1;
-
 
1059
    }
-
 
1060
   
-
 
1061
    proto->modfreq=IR_NEXA2_F_MOD;
-
 
1062
    proto->timeout=IR_NEXA2_START1/1000;
-
 
1063
    proto->repeats=IR_NEXA2_REPS;
1049
    return IR_NOT_CORRECT_DATA;
1064
    return IR_OK;
1050
}
1065
}
1051
 
1066
 
1052
 
1067
 
1053
#if (IR_PROTOCOLS_USE_NEXA1)
1068
#if (IR_PROTOCOLS_USE_NEXA1)
1054
/**
1069
/**