Mercurial > public > hwos_code
comparison src/hwos.inc @ 448:aadfe9f2edaf
work on new battery options
author | heinrichsweikamp |
---|---|
date | Tue, 30 Aug 2016 17:26:21 +0200 |
parents | d770f3d204c5 |
children | b4f28ab23b87 |
comparison
equal
deleted
inserted
replaced
447:f2a1d535347f | 448:aadfe9f2edaf |
---|---|
13 | 13 |
14 LIST P=18F87K22 ; change also: Configure->SelectDevice from Mplab | 14 LIST P=18F87K22 ; change also: Configure->SelectDevice from Mplab |
15 | 15 |
16 ;#DEFINE __DEBUG | 16 ;#DEFINE __DEBUG |
17 | 17 |
18 ;#DEFINE french_italian ; If defined, use french and italian instead of english and german | |
19 | |
18 #include <p18f87k22.inc> | 20 #include <p18f87k22.inc> |
19 #include <ports.inc> ; Portmap | 21 #include <ports.inc> ; Portmap |
20 | 22 |
21 ; Firmware definition | 23 ; Firmware definition |
22 #DEFINE softwareversion_x d'2' ; Software version XX.YY | 24 #DEFINE softwareversion_x d'2' ; Software version XX.YY |
23 #DEFINE softwareversion_y d'10' ; Software version XX.YY | 25 #DEFINE softwareversion_y d'10' ; Software version XX.YY |
24 #DEFINE softwareversion_beta 0 ; (and 0 for release) | 26 #DEFINE softwareversion_beta 1 ; (and 0 for release) |
25 ; Firmware version will appear in "Change Firmware" style | 27 ; Firmware version will appear in "Change Firmware" style |
26 #DEFINE firmware_expire_year .17 | 28 #DEFINE firmware_expire_year .17 |
27 #DEFINE firmware_expire_month .8 | 29 #DEFINE firmware_expire_month .8 |
28 #DEFINE firmware_expire_day .10 | 30 #DEFINE firmware_expire_day .10 |
29 | 31 |
162 ; 3,6V battery sensing data points at 70mA load | 164 ; 3,6V battery sensing data points at 70mA load |
163 #DEFINE lithium_36v_75 .3000 ; [mV] | 165 #DEFINE lithium_36v_75 .3000 ; [mV] |
164 #DEFINE lithium_36v_50 .2900 ; [mV] | 166 #DEFINE lithium_36v_50 .2900 ; [mV] |
165 #DEFINE lithium_36v_25 .2600 ; [mV] | 167 #DEFINE lithium_36v_25 .2600 ; [mV] |
166 #DEFINE lithium_36v_10 .2500 ; [mV] | 168 #DEFINE lithium_36v_10 .2500 ; [mV] |
167 | 169 |
170 ; Capacity for 2.4Ah Saft LS14500 and 0.8Ah Panasonic UR14500P | |
171 ; battery_gauge:6 is nAs | |
172 ; devide through 65536 | |
173 ; a) devide through 364 -> Result is in percent of a 2.4Ah Battery | |
174 ; or b) devide through 121 -> Result is in percent of a 0.8Ah Battery | |
175 | |
176 ; For internal battery gauging | |
177 #DEFINE internal_saft_capacity .364 | |
178 #DEFINE internal_panasonic_capacity .121 | |
179 | |
180 ; For gauge IC | |
181 #DEFINE saft_capacity .281 ; 2.4Ah/0.085mAh/100 [%] | |
182 #DEFINE saft_offset .37300 ; 65536-(2.4Ah/0.085mAh) | |
183 | |
184 #DEFINE panasonic_capacity .94 ; 0.8Ah/0.085mAh/100 [%] | |
185 #DEFINE panasonic_offset .56124 ; 65536-(0.8Ah/0.085mAh) | |
186 | |
187 #DEFINE ncr18650_capacity .364 ; 3.1Ah/0.085mAh/100 [%] | |
188 #DEFINE ncr18650_offset .29065 ; 65536-(3.1Ah/0.085mAh) | |
189 | |
168 #DEFINE current_sleepmode .31 | 190 #DEFINE current_sleepmode .31 |
169 #DEFINE current_backlight_multi .115 ; *CCPR1L+current_backlight_offset | 191 #DEFINE current_backlight_multi .115 ; *CCPR1L+current_backlight_offset |
170 #DEFINE current_backlight_offset .216 | 192 #DEFINE current_backlight_offset .216 |
171 #DEFINE current_speed_eco .1914 | 193 #DEFINE current_speed_eco .1914 |
172 #DEFINE current_speed_normal .4027 | 194 #DEFINE current_speed_normal .4027 |
200 ; Compass display | 222 ; Compass display |
201 #DEFINE compass_fast_treshold .9 ; show new heading instantly if new and old > compass_fast_treshold | 223 #DEFINE compass_fast_treshold .9 ; show new heading instantly if new and old > compass_fast_treshold |
202 #DEFINE compass_averaging .10 ; numbers of extra averaging | 224 #DEFINE compass_averaging .10 ; numbers of extra averaging |
203 | 225 |
204 ; Hardware defines | 226 ; Hardware defines |
205 #DEFINE rechargeable hardware_flag,0 ; OSTC has rechargeable battery with battery management chip | 227 #DEFINE battery_gauge_available hardware_flag,0 ; OSTC has rechargeable battery with battery management chip |
206 #DEFINE ambient_sensor hardware_flag,1 ; OSTC has an ambient sensor | 228 #DEFINE ambient_sensor hardware_flag,1 ; OSTC has an ambient sensor |
207 #DEFINE analog_o2_input hardware_flag,2 ; OSTC has analog inputs and S8 digital | 229 #DEFINE analog_o2_input hardware_flag,2 ; OSTC has analog inputs and S8 digital |
208 #DEFINE optical_input hardware_flag,3 ; OSTC has an digital optical input | 230 #DEFINE optical_input hardware_flag,3 ; OSTC has an digital optical input |
209 #DEFINE ble_available hardware_flag,4 ; OSTC has an BLE module | 231 #DEFINE ble_available hardware_flag,4 ; OSTC has an BLE module |
210 ;unused | 232 ;unused |
526 start_month res 1 ; At start of dive (For logbook) | 548 start_month res 1 ; At start of dive (For logbook) |
527 start_year res 1 ; At start of dive (For logbook) | 549 start_year res 1 ; At start of dive (For logbook) |
528 start_hours res 1 ; At start of dive (For logbook) | 550 start_hours res 1 ; At start of dive (For logbook) |
529 start_mins res 1 ; At start of dive (For logbook) | 551 start_mins res 1 ; At start of dive (For logbook) |
530 | 552 |
531 old_velocity res 4 ; Strores the last 4 speeds (8 seconds) in m/min | 553 old_velocity res 4 ; Stores the last 4 speeds (8 seconds) in m/min |
532 opt_gas_type_backup res 5 ; 0=Disabled, 1=First, 2=Travel, 3=Deco | 554 opt_gas_type_backup res 5 ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
533 opt_dil_type_backup res 5 ; 0=Disabled, 1=First, 2=Normal | 555 opt_dil_type_backup res 5 ; 0=Disabled, 1=First, 2=Normal |
534 opt_OC_bail_gas_change_backup res 5 ; Gas change depths OC/Bailout | 556 opt_OC_bail_gas_change_backup res 5 ; Gas change depths OC/Bailout |
535 | 557 |
558 internal_battery_capacity res 2 ; For internal battery gauging | |
559 battery_capacity res 2 ; For battery gauge IC | |
560 battery_offset res 2 ; For battery gauge IC | |
561 | |
562 analog_sw1 res 1 ; analog value for switch 1 | |
563 analog_sw2 res 1 ; analog value for switch 2 | |
564 battery_type res 1 ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah | |
536 | 565 |
537 ;----------------------------------------------------------------------------- | 566 ;----------------------------------------------------------------------------- |
538 ; Reserve BANK2 for general purpose buffer (strings, images, etc). | 567 ; Reserve BANK2 for general purpose buffer (strings, images, etc). |
539 ; NOTE: Needs to be aligned with a bank (LOW(buffer)==0). | 568 ; NOTE: Needs to be aligned with a bank (LOW(buffer)==0). |
540 buffer udata_ovr 0x200 | 569 buffer udata_ovr 0x200 |
707 #DEFINE blinking_depth_warning flag12,5 ; set by the color_depth. =1: warning color | 736 #DEFINE blinking_depth_warning flag12,5 ; set by the color_depth. =1: warning color |
708 #DEFINE blinking_depth_prev flag12,6 ; set by the TFT_depth. =1: prev display had warning color | 737 #DEFINE blinking_depth_prev flag12,6 ; set by the TFT_depth. =1: prev display had warning color |
709 #DEFINE blinking_depth_toggle flag12,7 ; toggle to blink | 738 #DEFINE blinking_depth_toggle flag12,7 ; toggle to blink |
710 | 739 |
711 #DEFINE neg_flag_velocity flag13,0 ; neg_flag backup for velocity logic | 740 #DEFINE neg_flag_velocity flag13,0 ; neg_flag backup for velocity logic |
712 ;#DEFINE unused | 741 #DEFINE analog_sw1_pressed flag13,1 ; =1: Analog switch 1 pressed |
713 ;#DEFINE unused | 742 #DEFINE analog_sw2_pressed flag13,2 ; =1: Analog switch 2 pressed |
714 #DEFINE sp2_switched flag13,3 ; =1: This setpoint has been autoselected already | 743 #DEFINE sp2_switched flag13,3 ; =1: This setpoint has been autoselected already |
715 #DEFINE sp3_switched flag13,4 ; =1: This setpoint has been autoselected already | 744 #DEFINE sp3_switched flag13,4 ; =1: This setpoint has been autoselected already |
716 #DEFINE sp4_switched flag13,5 ; =1: This setpoint has been autoselected already | 745 #DEFINE sp4_switched flag13,5 ; =1: This setpoint has been autoselected already |
717 #DEFINE sp5_switched flag13,6 ; =1: This setpoint has been autoselected already | 746 #DEFINE sp5_switched flag13,6 ; =1: This setpoint has been autoselected already |
747 #DEFINE analog_switches flag13,7 ; =1: Analog switches available | |
718 | 748 |
719 ;============================================================================= | 749 ;============================================================================= |
720 ; C-code Routines | 750 ; C-code Routines |
721 ; PART 2 | 751 ; PART 2 |
722 extern deco_calc_CNS_decrease_15min | 752 extern deco_calc_CNS_decrease_15min |