CRC16 correctur by get Info (0x85)
[owSlave2.git] / common / OWRomFunctions.s
index e5c007b..30731e7 100644 (file)
@@ -185,6 +185,8 @@ hrc_set_searchrom:
        lds r_rwbyte,owid ;erstes Byte lesen\r
        rjmp h_searchrom_next_bit\r
 \r
+\r
+\r
 hrc_start_read_command: ;Skip rom und Matchrom ok...\r
        ldi r_mode,OW_READ_COMMAND\r
        CRCInit1\r
@@ -318,8 +320,6 @@ h_fwconfiginfo:
        cpi  r_bytep,17\r
        breq h_fwconfiginfo_all\r
 #elif defined _CRC16_\r
-       cpi  r_bytep,17\r
-       breq h_fwconfiginfo_crc2\r
        cpi  r_bytep,18\r
        breq h_fwconfiginfo_all\r
 #else\r
@@ -327,15 +327,23 @@ h_fwconfiginfo:
        breq h_fwconfiginfo_all\r
 #warning No CRC known code implemented\r
 #endif\r
+h_fwconfiginfo_end:\r
        configZ config_info,r_bytep\r
        ld   r_rwbyte,Z\r
        rjmp handle_end_inc\r
 h_fwconfiginfo_crc:\r
+#ifdef _CRC8_\r
        lds r_rwbyte,crc\r
        rjmp handle_end_inc\r
-h_fwconfiginfo_crc2:\r
-       lds r_rwbyte,crc+1\r
-       rjmp handle_end_inc\r
+#elif defined _CRC16_\r
+       lds r_temp,crc\r
+       com r_temp\r
+       sts config_info+16,r_temp\r
+       lds r_temp,crc+1\r
+       com r_temp\r
+       sts config_info+17,r_temp\r
+       rjmp h_fwconfiginfo_end\r
+#endif\r
 h_fwconfiginfo_all:\r
        rjmp handle_end_sleep\r
 \r