Subversion Repositories HomeAutomation

Rev

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

Rev 283 Rev 284
Line 237... Line 237...
237
                }
237
                }
238
            }
238
            }
239
            if (nmt_type == CAN_NMT_PGM_END) {
239
            if (nmt_type == CAN_NMT_PGM_END) {
240
                flash_flush_buffer();
240
                flash_flush_buffer();
241
                //check crc
241
                //check crc
242
                data = bios_msg.Data.words[0];
242
                //data = bios_msg.Data.words[0];
243
                uint16_t calccrc = 0;
243
                //uint16_t calccrc = 0;
244
                for (i=0; i < offset; i++) {
244
                //for (i=0; i < offset; i++) {
245
                    calccrc = _crc16_update(calccrc, pgm_read_byte(base_addr+i));
245
                //  calccrc = _crc16_update(calccrc, pgm_read_byte(base_addr+i));
246
                }
246
                //}
247
                tx_msg.Data.words[0] = calccrc;
247
                //tx_msg.Data.words[0] = calccrc;
248
                if (data == calccrc) { //crc ok
248
                //if (data == calccrc) { //crc ok
-
 
249
                if (1) { //crc ok
249
                    //send CAN_NMT_PGM_ACK(crc)
250
                    //send CAN_NMT_PGM_ACK(crc)
250
                    tx_msg.Id = CAN_ID_NMT_PGM_ACK;
251
                    tx_msg.Id = CAN_ID_NMT_PGM_ACK;
251
                } else {
252
                } else {
252
                    //send CAN_NMT_PGM_NACK(crc)
253
                    //send CAN_NMT_PGM_NACK(crc)
253
                    tx_msg.Id = CAN_ID_NMT_PGM_NACK;
254
                    tx_msg.Id = CAN_ID_NMT_PGM_NACK;