Rev 701 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 701 | Rev 702 | ||
---|---|---|---|
1 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 | // + Copyright (c) 04.2007 Holger Buss |
2 | // + Copyright (c) 04.2007 Holger Buss |
3 | // + Nur für den privaten Gebrauch |
3 | // + Nur für den privaten Gebrauch |
4 | // + www.MikroKopter.com |
4 | // + www.MikroKopter.com |
5 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
6 | // + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
6 | // + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
7 | // + dass eine Nutzung (auch auszugsweise) nur für den privaten und nicht-kommerziellen Gebrauch zulässig ist. |
7 | // + dass eine Nutzung (auch auszugsweise) nur für den privaten und nicht-kommerziellen Gebrauch zulässig ist. |
8 | // + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
8 | // + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
9 | // + bzgl. der Nutzungsbedingungen aufzunehmen. |
9 | // + bzgl. der Nutzungsbedingungen aufzunehmen. |
10 | // + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
10 | // + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
11 | // + Verkauf von Luftbildaufnahmen, usw. |
11 | // + Verkauf von Luftbildaufnahmen, usw. |
12 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
12 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
13 | // + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
13 | // + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
14 | // + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
14 | // + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
15 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
15 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
16 | // + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
16 | // + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
17 | // + auf anderen Webseiten oder Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
17 | // + auf anderen Webseiten oder Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
18 | // + eindeutig als Ursprung verlinkt und genannt werden |
18 | // + eindeutig als Ursprung verlinkt und genannt werden |
19 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
19 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
20 | // + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
20 | // + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
21 | // + Benutzung auf eigene Gefahr |
21 | // + Benutzung auf eigene Gefahr |
22 | // + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
22 | // + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
23 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
23 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
24 | // + Die Portierung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
24 | // + Die Portierung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
25 | // + mit unserer Zustimmung zulässig |
25 | // + mit unserer Zustimmung zulässig |
26 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
26 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
27 | // + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
27 | // + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
28 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
28 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29 | // + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
29 | // + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
30 | // + this list of conditions and the following disclaimer. |
30 | // + this list of conditions and the following disclaimer. |
31 | // + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
31 | // + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
32 | // + from this software without specific prior written permission. |
32 | // + from this software without specific prior written permission. |
33 | // + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
33 | // + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
34 | // + for non-commercial use (directly or indirectly) |
34 | // + for non-commercial use (directly or indirectly) |
35 | // + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
35 | // + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
36 | // + with our written permission |
36 | // + with our written permission |
37 | // + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
37 | // + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
38 | // + clearly linked as origin |
38 | // + clearly linked as origin |
39 | // + * porting to systems other than hardware from www.mikrokopter.de is not allowed |
39 | // + * porting to systems other than hardware from www.mikrokopter.de is not allowed |
40 | // + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
40 | // + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
41 | // + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
41 | // + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
42 | // + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
42 | // + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
43 | // + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
43 | // + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
44 | // + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
44 | // + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
45 | // + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
45 | // + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
46 | // + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
46 | // + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
47 | // + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
47 | // + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
48 | // + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
48 | // + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
49 | // + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
49 | // + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
50 | // + POSSIBILITY OF SUCH DAMAGE. |
50 | // + POSSIBILITY OF SUCH DAMAGE. |
51 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
51 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
52 | #include <avr/boot.h> |
52 | #include <avr/boot.h> |
53 | 53 | ||
54 | #include <avr/io.h> |
54 | #include <avr/io.h> |
55 | #include <avr/interrupt.h> |
55 | #include <avr/interrupt.h> |
56 | 56 | ||
57 | #include "main.h" |
57 | #include "main.h" |
58 | #include "timer0.h" |
58 | #include "timer0.h" |
59 | #include "timer2.h" |
59 | #include "timer2.h" |
60 | #include "uart.h" |
60 | #include "uart.h" |
61 | #include "uart1.h" |
61 | #include "uart1.h" |
62 | #include "menu.h" |
62 | #include "menu.h" |
63 | #include "fc.h" |
63 | #include "fc.h" |
64 | #include "rc.h" |
64 | #include "rc.h" |
65 | #include "analog.h" |
65 | #include "analog.h" |
66 | #include "printf_P.h" |
66 | #include "printf_P.h" |
67 | //#include "spi.h" |
67 | //#include "spi.h" |
68 | #include "mm3.h" |
68 | #include "mm3.h" |
69 | #include "twimaster.h" |
69 | #include "twimaster.h" |
70 | #include "eeprom.h" |
70 | #include "eeprom.h" |
71 | #include "_Settings.h" |
71 | #include "_Settings.h" |
72 | 72 | ||
73 | 73 | ||
74 | 74 | ||
75 | uint8_t BoardRelease = 10; |
75 | uint8_t BoardRelease = 10; |
76 | 76 | ||
77 | 77 | ||
78 | //############################################################################ |
78 | //############################################################################ |
79 | //Hauptprogramm |
79 | //Hauptprogramm |
80 | int main (void) |
80 | int main (void) |
81 | //############################################################################ |
81 | //############################################################################ |
82 | { |
82 | { |
83 | unsigned int timer; |
83 | unsigned int timer; |
84 | 84 | ||
85 | // disable interrupts global |
85 | // disable interrupts global |
86 | cli(); |
86 | cli(); |
87 | 87 | ||
88 | DDRB = 0x00; |
88 | DDRB = 0x00; |
89 | PORTB = 0x00; |
89 | PORTB = 0x00; |
90 | for(timer = 0; timer < 1000; timer++); // make delay |
90 | for(timer = 0; timer < 1000; timer++); // make delay |
91 | 91 | ||
92 | 92 | ||
93 | if(PINB & 0x01) BoardRelease = 11; |
93 | if(PINB & 0x01) BoardRelease = 11; |
94 | else BoardRelease = 10; |
94 | else BoardRelease = 10; |
95 | 95 | ||
96 | DDRC = 0x81; // SCL & Speaker |
96 | DDRC = 0x81; // SCL & Speaker |
97 | PORTC = 0xff; // Pullup SDA |
97 | PORTC = 0xff; // Pullup SDA |
98 | DDRB = 0x1B; // LEDs und Druckoffset |
98 | DDRB = 0x1B; // LEDs und Druckoffset |
99 | PORTB = 0x01; // LED_Rot |
99 | PORTB = 0x01; // LED_Rot |
100 | DDRD = 0x3E; // Speaker & TXD & J3 J4 J5 |
100 | DDRD = 0x3E; // Speaker & TXD & J3 J4 J5 |
101 | DDRD |=0x80; // J7 |
101 | DDRD |=0x80; // J7 |
102 | 102 | ||
103 | PORTD = 0xF7; // LED |
103 | PORTD = 0xF7; // LED |
104 | 104 | ||
105 | 105 | ||
106 | MCUSR &=~(1<<WDRF); |
106 | MCUSR &=~(1<<WDRF); |
107 | WDTCSR |= (1<<WDCE)|(1<<WDE); |
107 | WDTCSR |= (1<<WDCE)|(1<<WDE); |
108 | WDTCSR = 0; |
108 | WDTCSR = 0; |
109 | 109 | ||
110 | BeepTime = 2000; |
110 | BeepTime = 2000; |
111 | 111 | ||
112 | PPM_in[CH_GAS] = 0; |
112 | PPM_in[CH_GAS] = 0; |
113 | StickYaw = 0; |
113 | StickYaw = 0; |
114 | StickRoll = 0; |
114 | StickRoll = 0; |
115 | StickPitch = 0; |
115 | StickPitch = 0; |
116 | 116 | ||
117 | ROT_OFF; |
117 | ROT_OFF; |
118 | 118 | ||
119 | TIMER0_Init(); |
119 | TIMER0_Init(); |
120 | TIMER2_Init(); |
120 | TIMER2_Init(); |
121 | USART0_Init(); |
121 | USART0_Init(); |
122 | //USART1_Init(); |
122 | USART1_Init(); |
123 | rc_sum_init(); |
123 | rc_sum_init(); |
124 | ADC_Init(); |
124 | ADC_Init(); |
125 | i2c_init(); |
125 | i2c_init(); |
126 | MM3_init(); |
126 | MM3_init(); |
127 | //SPI_MasterInit(); |
127 | //SPI_MasterInit(); |
128 | 128 | ||
129 | // enable interrupts global |
129 | // enable interrupts global |
130 | sei(); |
130 | sei(); |
131 | 131 | ||
132 | VersionInfo.Hauptversion = VERSION_HAUPTVERSION; |
132 | VersionInfo.Hauptversion = VERSION_HAUPTVERSION; |
133 | VersionInfo.Nebenversion = VERSION_NEBENVERSION; |
133 | VersionInfo.Nebenversion = VERSION_NEBENVERSION; |
134 | VersionInfo.PCKompatibel = VERSION_KOMPATIBEL; |
134 | VersionInfo.PCKompatibel = VERSION_KOMPATIBEL; |
135 | 135 | ||
136 | printf("\n\rFlightControl\n\rHardware:%d.%d\n\rSoftware:V%d.%d%c ",BoardRelease/10,BoardRelease%10, VERSION_HAUPTVERSION, VERSION_NEBENVERSION,VERSION_INDEX + 'a'); |
136 | printf("\n\rFlightControl\n\rHardware:%d.%d\n\rSoftware:V%d.%d%c ",BoardRelease/10,BoardRelease%10, VERSION_HAUPTVERSION, VERSION_NEBENVERSION,VERSION_INDEX + 'a'); |
137 | printf("\n\r=============================="); |
137 | printf("\n\r=============================="); |
138 | GRN_ON; |
138 | GRN_ON; |
139 | 139 | ||
140 | // Parameter set handling |
140 | // Parameter set handling |
141 | ParamSet_Init(); |
141 | ParamSet_Init(); |
142 | 142 | ||
143 | if(GetParamByte(PID_ACC_PITCH) > 4) |
143 | if(GetParamByte(PID_ACC_PITCH) > 4) |
144 | { |
144 | { |
145 | printf("\n\rACC nicht abgeglichen!"); |
145 | printf("\n\rACC nicht abgeglichen!"); |
146 | } |
146 | } |
147 | 147 | ||
148 | //kurze Wartezeit (sonst reagiert die "Kompass kalibrieren?"-Abfrage nicht |
148 | //kurze Wartezeit (sonst reagiert die "Kompass kalibrieren?"-Abfrage nicht |
149 | timer = SetDelay(500); |
149 | timer = SetDelay(500); |
150 | while(!CheckDelay(timer)); |
150 | while(!CheckDelay(timer)); |
151 | 151 | ||
152 | //Compass calibration? |
152 | //Compass calibration? |
153 | if(PPM_in[ParamSet.ChannelAssignment[CH_GAS]] > 100 && PPM_in[ParamSet.ChannelAssignment[CH_YAW]] > 100) |
153 | if(PPM_in[ParamSet.ChannelAssignment[CH_GAS]] > 100 && PPM_in[ParamSet.ChannelAssignment[CH_YAW]] > 100) |
154 | { |
154 | { |
155 | printf("\n\rCalibrating Compass"); |
155 | printf("\n\rCalibrating Compass"); |
156 | MM3_calibrate(); |
156 | MM3_calibrate(); |
157 | } |
157 | } |
158 | 158 | ||
159 | 159 | ||
160 | if(ParamSet.GlobalConfig & CFG_HEIGHT_CONTROL) |
160 | if(ParamSet.GlobalConfig & CFG_HEIGHT_CONTROL) |
161 | { |
161 | { |
162 | printf("\n\rAbgleich Luftdrucksensor.."); |
162 | printf("\n\rAbgleich Luftdrucksensor.."); |
163 | timer = SetDelay(1000); |
163 | timer = SetDelay(1000); |
164 | SearchAirPressureOffset(); |
164 | SearchAirPressureOffset(); |
165 | while (!CheckDelay(timer)); |
165 | while (!CheckDelay(timer)); |
166 | printf("OK\n\r"); |
166 | printf("OK\n\r"); |
167 | } |
167 | } |
168 | 168 | ||
169 | SetNeutral(); |
169 | SetNeutral(); |
170 | 170 | ||
171 | ROT_OFF; |
171 | ROT_OFF; |
172 | 172 | ||
173 | BeepTime = 2000; |
173 | BeepTime = 2000; |
174 | ExternControl.Digital[0] = 0x55; |
174 | ExternControl.Digital[0] = 0x55; |
175 | 175 | ||
176 | 176 | ||
177 | printf("\n\rSteuerung: "); |
177 | printf("\n\rSteuerung: "); |
178 | if (ParamSet.GlobalConfig & CFG_HEADING_HOLD) printf("HeadingHold"); |
178 | if (ParamSet.GlobalConfig & CFG_HEADING_HOLD) printf("HeadingHold"); |
179 | else printf("Neutral"); |
179 | else printf("Neutral"); |
180 | 180 | ||
181 | printf("\n\n\r"); |
181 | printf("\n\n\r"); |
182 | 182 | ||
183 | LCD_Clear(); |
183 | LCD_Clear(); |
- | 184 | ||
184 | I2CTimeout = 5000; |
185 | I2CTimeout = 5000; |
185 | while (1) |
186 | while (1) |
186 | { |
187 | { |
187 | if(UpdateMotor) // ReglerIntervall |
188 | if(UpdateMotor) // ReglerIntervall |
188 | { |
189 | { |
189 | //SPI_TransmitByte(); //# |
190 | //SPI_TransmitByte(); //# |
190 | UpdateMotor=0; |
191 | UpdateMotor=0; |
191 | //PORTD |= 0x08; |
192 | //PORTD |= 0x08; |
192 | MotorRegler(); |
193 | MotorRegler(); |
193 | 194 | ||
194 | //PORTD &= ~0x08; |
195 | //PORTD &= ~0x08; |
195 | SendMotorData(); |
196 | SendMotorData(); |
196 | ROT_OFF; |
197 | ROT_OFF; |
197 | if(PcZugriff) PcZugriff--; |
198 | if(PcZugriff) PcZugriff--; |
198 | else |
199 | else |
199 | { |
200 | { |
200 | DubWiseKeys[0] = 0; |
201 | DubWiseKeys[0] = 0; |
201 | DubWiseKeys[1] = 0; |
202 | DubWiseKeys[1] = 0; |
202 | ExternControl.Config = 0; |
203 | ExternControl.Config = 0; |
203 | ExternStickPitch= 0; |
204 | ExternStickPitch= 0; |
204 | ExternStickRoll = 0; |
205 | ExternStickRoll = 0; |
205 | ExternStickYaw = 0; |
206 | ExternStickYaw = 0; |
206 | } |
207 | } |
207 | if(SenderOkay) SenderOkay--; |
208 | if(SenderOkay) SenderOkay--; |
208 | if(!I2CTimeout) |
209 | if(!I2CTimeout) |
209 | { |
210 | { |
210 | I2CTimeout = 5; |
211 | I2CTimeout = 5; |
211 | i2c_reset(); |
212 | i2c_reset(); |
212 | if((BeepModulation == 0xFFFF) && MotorsOn) |
213 | if((BeepModulation == 0xFFFF) && MotorsOn) |
213 | { |
214 | { |
214 | BeepTime = 10000; // 1 second |
215 | BeepTime = 10000; // 1 second |
215 | BeepModulation = 0x0080; |
216 | BeepModulation = 0x0080; |
216 | } |
217 | } |
217 | } |
218 | } |
218 | else |
219 | else |
219 | { |
220 | { |
220 | I2CTimeout--; |
221 | I2CTimeout--; |
221 | ROT_OFF; |
222 | ROT_OFF; |
222 | } |
223 | } |
223 | if(SIO_DEBUG && !UpdateMotor) |
224 | if(SIO_DEBUG && !UpdateMotor) |
224 | { |
225 | { |
225 | DatenUebertragung(); |
226 | DatenUebertragung(); |
226 | BearbeiteRxDaten(); |
227 | BearbeiteRxDaten(); |
227 | } |
228 | } |
228 | else BearbeiteRxDaten(); |
229 | else BearbeiteRxDaten(); |
229 | if(CheckDelay(timer)) |
230 | if(CheckDelay(timer)) |
230 | { |
231 | { |
231 | if(UBat < ParamSet.LowVoltageWarning) |
232 | if(UBat < ParamSet.LowVoltageWarning) |
232 | { |
233 | { |
233 | if(BeepModulation == 0xFFFF) |
234 | if(BeepModulation == 0xFFFF) |
234 | { |
235 | { |
235 | BeepTime = 6000; // 0.6 seconds |
236 | BeepTime = 6000; // 0.6 seconds |
236 | BeepModulation = 0x0300; |
237 | BeepModulation = 0x0300; |
237 | } |
238 | } |
238 | } |
239 | } |
239 | //SPI_StartTransmitPacket();//# |
240 | //SPI_StartTransmitPacket();//# |
240 | timer = SetDelay(100); |
241 | timer = SetDelay(100); |
241 | } |
242 | } |
242 | //if(UpdateMotor) DebugOut.Analog[26]++; |
243 | //if(UpdateMotor) DebugOut.Analog[26]++; |
243 | } |
244 | } |
244 | } |
245 | } |
245 | return (1); |
246 | return (1); |
246 | } |
247 | } |
247 | 248 | ||
248 | 249 |