comparison src/ghostwriter.asm @ 278:dfac47ac2e1d

BUGFIX: There was a 1:4096 chance that a portion of a dive was not stored correctly resulting in download issues
author heinrichsweikamp
date Mon, 18 May 2015 21:25:56 +0200
parents 653a3ab08062
children 62c7af4795b0
comparison
equal deleted inserted replaced
277:24daa6523218 278:dfac47ac2e1d
366 rcall ghostwriter_load_pointer ; Load ext_flash_address:3 from EEPROM .4-.6 366 rcall ghostwriter_load_pointer ; Load ext_flash_address:3 from EEPROM .4-.6
367 367
368 incf_ext_flash_address_0x20 d'6' ; Skip internal "0xFA 0xFA #Divenumber:2 0xFA 0xFA" Header 368 incf_ext_flash_address_0x20 d'6' ; Skip internal "0xFA 0xFA #Divenumber:2 0xFA 0xFA" Header
369 ; Store dive length 369 ; Store dive length
370 movf ext_flash_dive_counter+0,W 370 movf ext_flash_dive_counter+0,W
371 call write_byte_ext_flash_plus_nocnt ; WREG -> Profile in ext. flash (No ext_flash_dive_counter:3 increase) 371 call write_byte_ext_flash_plus_nodel ; WREG -> Profile in ext. flash (No ext_flash_dive_counter:3 increase) and does NOT delete 4kB page
372 movf ext_flash_dive_counter+1,W 372 movf ext_flash_dive_counter+1,W
373 call write_byte_ext_flash_plus_nocnt ; WREG -> Profile in ext. flash (No ext_flash_dive_counter:3 increase) 373 call write_byte_ext_flash_plus_nodel ; WREG -> Profile in ext. flash (No ext_flash_dive_counter:3 increase) and does NOT delete 4kB page
374 movf ext_flash_dive_counter+2,W 374 movf ext_flash_dive_counter+2,W
375 call write_byte_ext_flash_plus_nocnt ; WREG -> Profile in ext. flash (No ext_flash_dive_counter:3 increase) 375 call write_byte_ext_flash_plus_nodel ; WREG -> Profile in ext. flash (No ext_flash_dive_counter:3 increase) and does NOT delete 4kB page
376 376
377 ; profile recording done. 377 ; profile recording done.
378 378
379 ; Load total number of dives 379 ; Load total number of dives
380 read_int_eeprom .2 380 read_int_eeprom .2
881 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash 881 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash
882 movlw 0xFA 882 movlw 0xFA
883 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash 883 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash
884 movlw 0xFA 884 movlw 0xFA
885 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash 885 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash
886
886 ; Keep room for dive length ext_flash_dive_counter:3 (Stored at the end of the dive) 887 ; Keep room for dive length ext_flash_dive_counter:3 (Stored at the end of the dive)
887 incf_ext_flash_address_0x20 d'3' ; Skip Bytes in external flash (faster) 888 ; Writing 0xFF three times here is mandatory
889 ; - 0xFF can be overwritten after the dive
890 ; - ghostwrite_byte_profile takes care of 4kB Page switching
891 ; - fixes an issue when we are at exactly 0xXXX000 here...
892
893 movlw 0xFF
894 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash
895 movlw 0xFF
896 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash
897 movlw 0xFF
898 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash
888 899
889 movf samplingrate,W ; Sampling rate 900 movf samplingrate,W ; Sampling rate
890 btfsc FLAG_apnoe_mode ; Apnoe mode? 901 btfsc FLAG_apnoe_mode ; Apnoe mode?
891 movlw samplingrate_apnoe ; Apnoe sampling rate 902 movlw samplingrate_apnoe ; Apnoe sampling rate
892 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash 903 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash