Subversion Repositories HomeAutomation

Rev

Rev 154 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 154 Rev 156
Line 135... Line 135...
135
        /* check temperature and send on CAN once every other second */
135
        /* check temperature and send on CAN once every other second */
136
        if (Timebase_PassedTimeMillis(timeStamp) >= 2000) {
136
        if (Timebase_PassedTimeMillis(timeStamp) >= 2000) {
137
            timeStamp = Timebase_CurrentTime();
137
            timeStamp = Timebase_CurrentTime();
138
           
138
           
139
            if ( DS18X20_start_meas( DS18X20_POWER_PARASITE, NULL ) == DS18X20_OK) {
139
            if ( DS18X20_start_meas( DS18X20_POWER_PARASITE, NULL ) == DS18X20_OK) {
-
 
140
                printf("Measuring temperature... ");
140
                delay_ms(DS18B20_TCONV_12BIT);
141
                delay_ms(DS18B20_TCONV_12BIT);
141
                for ( i=0; i<nSensors; i++ ) {
142
                for ( i=0; i<nSensors; i++ ) {
142
                    if ( DS18X20_read_meas( &gSensorIDs[i][0], &subzero,
143
                    if ( DS18X20_read_meas( &gSensorIDs[i][0], &subzero,
143
                            &cel, &cel_frac_bits) == DS18X20_OK ) {
144
                            &cel, &cel_frac_bits) == DS18X20_OK ) {
144
                       
145
                       
Line 156... Line 157...
156
                }
157
                }
157
            }
158
            }
158
            else printf("Start meas. failed (short circuit?)\n");
159
            else printf("Start meas. failed (short circuit?)\n");
159
 
160
 
160
            txMsg.DataLength = nSensors*2;
161
            txMsg.DataLength = nSensors*2;
-
 
162
            printf("sending...\n");
161
            /* send txMsg */
163
            /* send txMsg */
162
            Can_Send(&txMsg);
164
            Can_Send(&txMsg);
163
        }
165
        }
164
    }
166
    }
165
   
167