Rev 231 | Rev 234 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 231 | Rev 232 | ||
---|---|---|---|
1 | /*#######################################################################################*/ |
1 | /*#######################################################################################*/ |
2 | /* !!! THIS IS NOT FREE SOFTWARE !!! */ |
2 | /* !!! THIS IS NOT FREE SOFTWARE !!! */ |
3 | /*#######################################################################################*/ |
3 | /*#######################################################################################*/ |
4 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
4 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5 | // + Copyright (c) 2008 Ingo Busker, Holger Buss |
5 | // + Copyright (c) 2008 Ingo Busker, Holger Buss |
6 | // + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
6 | // + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
7 | // + FOR NON COMMERCIAL USE ONLY |
7 | // + FOR NON COMMERCIAL USE ONLY |
8 | // + www.MikroKopter.com |
8 | // + www.MikroKopter.com |
9 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
9 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
10 | // + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
10 | // + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
11 | // + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
11 | // + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
12 | // + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
12 | // + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
13 | // + bzgl. der Nutzungsbedingungen aufzunehmen. |
13 | // + bzgl. der Nutzungsbedingungen aufzunehmen. |
14 | // + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
14 | // + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
15 | // + Verkauf von Luftbildaufnahmen, usw. |
15 | // + Verkauf von Luftbildaufnahmen, usw. |
16 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
16 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
17 | // + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
17 | // + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
18 | // + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
18 | // + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
19 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
19 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
20 | // + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
20 | // + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
21 | // + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
21 | // + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
22 | // + eindeutig als Ursprung verlinkt werden |
22 | // + eindeutig als Ursprung verlinkt werden |
23 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
23 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
24 | // + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
24 | // + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
25 | // + Benutzung auf eigene Gefahr |
25 | // + Benutzung auf eigene Gefahr |
26 | // + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
26 | // + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
27 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
27 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
28 | // + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
28 | // + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
29 | // + mit unserer Zustimmung zulässig |
29 | // + mit unserer Zustimmung zulässig |
30 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
31 | // + Teile, die nicht eindeutig mit unserer Lizenzvereinbarung gekennzeichnet sind, unterliegen u.U. eigenen Vereinbarungen: |
31 | // + Teile, die nicht eindeutig mit unserer Lizenzvereinbarung gekennzeichnet sind, unterliegen u.U. eigenen Vereinbarungen: |
32 | // + z.B. Die Funktion printf_P() unterliegt ihrer eigenen Lizenz |
32 | // + z.B. Die Funktion printf_P() unterliegt ihrer eigenen Lizenz |
33 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
33 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
34 | // + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
34 | // + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
35 | // + this list of conditions and the following disclaimer. |
35 | // + this list of conditions and the following disclaimer. |
36 | // + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
36 | // + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
37 | // + from this software without specific prior written permission. |
37 | // + from this software without specific prior written permission. |
38 | // + * The use of this project (hardware, software, binary files, sources and documentation) is only permitted |
38 | // + * The use of this project (hardware, software, binary files, sources and documentation) is only permitted |
39 | // + for non-commercial use (directly or indirectly) |
39 | // + for non-commercial use (directly or indirectly) |
40 | // + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
40 | // + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
41 | // + with our written permission |
41 | // + with our written permission |
42 | // + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
42 | // + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
43 | // + clearly linked as origin |
43 | // + clearly linked as origin |
44 | // + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
44 | // + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
45 | // |
45 | // |
46 | // + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
46 | // + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
47 | // + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
47 | // + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
48 | // + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
48 | // + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
49 | // + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
49 | // + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
50 | // + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
50 | // + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
51 | // + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
51 | // + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
52 | // + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
52 | // + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
53 | // + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
53 | // + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
54 | // + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
54 | // + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
55 | // + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
55 | // + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
56 | // + POSSIBILITY OF SUCH DAMAGE. |
56 | // + POSSIBILITY OF SUCH DAMAGE. |
57 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
57 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
58 | //#define MCLK96MHZ |
58 | //#define MCLK96MHZ |
59 | const unsigned long _Main_Crystal = 25000; |
59 | const unsigned long _Main_Crystal = 25000; |
60 | #include <stdio.h> |
60 | #include <stdio.h> |
61 | #include "91x_lib.h" |
61 | #include "91x_lib.h" |
62 | #include "led.h" |
62 | #include "led.h" |
63 | #include "uart0.h" |
63 | #include "uart0.h" |
64 | #include "uart1.h" |
64 | #include "uart1.h" |
65 | #include "uart2.h" |
65 | #include "uart2.h" |
66 | #include "gps.h" |
66 | #include "gps.h" |
67 | #include "i2c.h" |
67 | #include "i2c.h" |
68 | #include "timer1.h" |
68 | #include "timer1.h" |
69 | #include "timer2.h" |
69 | #include "timer2.h" |
70 | #include "analog.h" |
70 | #include "analog.h" |
71 | #include "spi_slave.h" |
71 | #include "spi_slave.h" |
72 | #include "fat16.h" |
72 | #include "fat16.h" |
73 | #include "usb.h" |
73 | #include "usb.h" |
74 | #include "sdc.h" |
74 | #include "sdc.h" |
75 | #include "logging.h" |
75 | #include "logging.h" |
76 | #include "params.h" |
76 | #include "params.h" |
77 | #include "settings.h" |
77 | #include "settings.h" |
78 | #include "config.h" |
78 | #include "config.h" |
79 | #include "main.h" |
79 | #include "main.h" |
80 | 80 | ||
81 | u8 BoardRelease = 0; |
81 | u8 BoardRelease = 0; |
82 | u32 TimerCheckError; |
82 | u32 TimerCheckError; |
83 | u32 ErrorCode = 0; |
83 | u32 ErrorCode = 0; |
84 | u16 BeepTime; |
84 | u16 BeepTime; |
85 | u8 NCFlags = 0; |
85 | u8 NCFlags = 0; |
86 | s16 GeoMagDec = 0; // local magnetic declination in 0.1 deg |
86 | s16 GeoMagDec = 0; // local magnetic declination in 0.1 deg |
87 | 87 | ||
88 | u8 ClearFCFlags = 0; |
88 | u8 ClearFCFlags = 0; |
89 | u8 StopNavigation = 0; |
89 | u8 StopNavigation = 0; |
90 | Param_t Parameter; |
90 | Param_t Parameter; |
91 | volatile FC_t FC; |
91 | volatile FC_t FC; |
92 | 92 | ||
93 | s8 ErrorMSG[25]; |
93 | s8 ErrorMSG[25]; |
94 | 94 | ||
95 | //---------------------------------------------------------------------------------------------------- |
95 | //---------------------------------------------------------------------------------------------------- |
96 | void SCU_Config(void) |
96 | void SCU_Config(void) |
97 | { |
97 | { |
98 | /* configure PLL and set it as master clock source */ |
98 | /* configure PLL and set it as master clock source */ |
99 | SCU_MCLKSourceConfig(SCU_MCLK_OSC); // set master clock source to external oscillator clock (25MHz) before diabling the PLL |
99 | SCU_MCLKSourceConfig(SCU_MCLK_OSC); // set master clock source to external oscillator clock (25MHz) before diabling the PLL |
100 | SCU_PLLCmd(DISABLE); // now disable the PLL |
100 | SCU_PLLCmd(DISABLE); // now disable the PLL |
101 | #ifdef MCLK96MHZ |
101 | #ifdef MCLK96MHZ |
102 | SCU_BRCLKDivisorConfig(SCU_BRCLK_Div2); // set BRCLK to MCLK/2 = 48MHz |
102 | SCU_BRCLKDivisorConfig(SCU_BRCLK_Div2); // set BRCLK to MCLK/2 = 48MHz |
103 | SCU_PCLKDivisorConfig(SCU_PCLK_Div4); // set PCLK (APB bus clock) divisor to 4 (half Reference Clock) |
103 | SCU_PCLKDivisorConfig(SCU_PCLK_Div4); // set PCLK (APB bus clock) divisor to 4 (half Reference Clock) |
104 | SCU_RCLKDivisorConfig(SCU_RCLK_Div2); // set RCLK (Reference Clock) divisor to 1 (full PPL clock) |
104 | SCU_RCLKDivisorConfig(SCU_RCLK_Div2); // set RCLK (Reference Clock) divisor to 1 (full PPL clock) |
105 | SCU_HCLKDivisorConfig(SCU_HCLK_Div2); // set HCLK (AHB bus clock) divisor to 1 (full Reference Clock) |
105 | SCU_HCLKDivisorConfig(SCU_HCLK_Div2); // set HCLK (AHB bus clock) divisor to 1 (full Reference Clock) |
106 | SCU_PLLFactorsConfig(192,25,2); // PLL = 96 MHz, Feedback Divider N=192, Pre-Divider M=25, Post-Divider P=2 |
106 | SCU_PLLFactorsConfig(192,25,2); // PLL = 96 MHz, Feedback Divider N=192, Pre-Divider M=25, Post-Divider P=2 |
107 | #else |
107 | #else |
108 | SCU_BRCLKDivisorConfig(SCU_BRCLK_Div1); // set BRCLK to MCLK = 48MHz |
108 | SCU_BRCLKDivisorConfig(SCU_BRCLK_Div1); // set BRCLK to MCLK = 48MHz |
109 | SCU_PCLKDivisorConfig(SCU_PCLK_Div2); // set PCLK (APB bus clock) divisor to 2 (half Reference Clock) |
109 | SCU_PCLKDivisorConfig(SCU_PCLK_Div2); // set PCLK (APB bus clock) divisor to 2 (half Reference Clock) |
110 | SCU_RCLKDivisorConfig(SCU_RCLK_Div1); // set RCLK (Reference Clock) divisor to 1 (full PPL clock) |
110 | SCU_RCLKDivisorConfig(SCU_RCLK_Div1); // set RCLK (Reference Clock) divisor to 1 (full PPL clock) |
111 | SCU_HCLKDivisorConfig(SCU_HCLK_Div1); // set HCLK (AHB bus clock) divisor to 1 (full Reference Clock) |
111 | SCU_HCLKDivisorConfig(SCU_HCLK_Div1); // set HCLK (AHB bus clock) divisor to 1 (full Reference Clock) |
112 | SCU_PLLFactorsConfig(192,25,3); // PLL = 48 MHz, Feedback Divider N=192, Pre-Divider M=25, Post-Divider P=3 |
112 | SCU_PLLFactorsConfig(192,25,3); // PLL = 48 MHz, Feedback Divider N=192, Pre-Divider M=25, Post-Divider P=3 |
113 | #endif |
113 | #endif |
114 | SCU_PLLCmd(ENABLE); // Enable PLL (is disabled by SCU_PLLFactorsConfig) |
114 | SCU_PLLCmd(ENABLE); // Enable PLL (is disabled by SCU_PLLFactorsConfig) |
115 | SCU_MCLKSourceConfig(SCU_MCLK_PLL); // set master clock source to PLL |
115 | SCU_MCLKSourceConfig(SCU_MCLK_PLL); // set master clock source to PLL |
116 | } |
116 | } |
117 | 117 | ||
118 | //---------------------------------------------------------------------------------------------------- |
118 | //---------------------------------------------------------------------------------------------------- |
119 | void GetNaviCtrlVersion(void) |
119 | void GetNaviCtrlVersion(void) |
120 | { |
120 | { |
121 | u8 msg[25]; |
121 | u8 msg[25]; |
122 | 122 | ||
123 | sprintf(msg,"\n\r NaviCtrl V%d.%d%c", VERSION_MAJOR, VERSION_MINOR, 'a'+ VERSION_PATCH); |
123 | sprintf(msg,"\n\r NaviCtrl V%d.%d%c", VERSION_MAJOR, VERSION_MINOR, 'a'+ VERSION_PATCH); |
124 | UART1_PutString(msg); |
124 | UART1_PutString(msg); |
125 | } |
125 | } |
126 | 126 | ||
127 | //---------------------------------------------------------------------------------------------------- |
127 | //---------------------------------------------------------------------------------------------------- |
128 | #define DEFEKT_G_NICK 0x01 |
128 | #define DEFEKT_G_NICK 0x01 |
129 | #define DEFEKT_G_ROLL 0x02 |
129 | #define DEFEKT_G_ROLL 0x02 |
130 | #define DEFEKT_G_GIER 0x04 |
130 | #define DEFEKT_G_GIER 0x04 |
131 | #define DEFEKT_A_NICK 0x08 |
131 | #define DEFEKT_A_NICK 0x08 |
132 | #define DEFEKT_A_ROLL 0x10 |
132 | #define DEFEKT_A_ROLL 0x10 |
133 | #define DEFEKT_A_Z 0x20 |
133 | #define DEFEKT_A_Z 0x20 |
134 | #define DEFEKT_PRESSURE 0x40 |
134 | #define DEFEKT_PRESSURE 0x40 |
135 | #define DEFEKT_CAREFREE_ERR 0x80 |
135 | #define DEFEKT_CAREFREE_ERR 0x80 |
136 | 136 | ||
137 | #define DEFEKT_I2C 0x01 |
137 | #define DEFEKT_I2C 0x01 |
138 | #define DEFEKT_BL_MISSING 0x02 |
138 | #define DEFEKT_BL_MISSING 0x02 |
139 | #define DEFEKT_SPI_RX_ERR 0x04 |
139 | #define DEFEKT_SPI_RX_ERR 0x04 |
140 | #define DEFEKT_PPM_ERR 0x08 |
140 | #define DEFEKT_PPM_ERR 0x08 |
141 | #define DEFEKT_MIXER_ERR 0x10 |
141 | #define DEFEKT_MIXER_ERR 0x10 |
142 | //---------------------------------------------------------------------------------------------------- |
142 | //---------------------------------------------------------------------------------------------------- |
143 | #define ERROR_FC_COMMUNICATION 0x01 |
143 | #define ERROR_FC_COMMUNICATION 0x01 |
144 | #define ERROR_MK3_COMMUNICATION 0x02 |
144 | #define ERROR_MK3_COMMUNICATION 0x02 |
145 | #define ERROR_FC_INCOMPATIBLE 0x04 |
145 | #define ERROR_FC_INCOMPATIBLE 0x04 |
146 | #define ERROR_MK3_INCOMPATIBLE 0x08 |
146 | #define ERROR_MK3_INCOMPATIBLE 0x08 |
147 | #define ERROR_GPS_COMMUNICATION 0x10 |
147 | #define ERROR_GPS_COMMUNICATION 0x10 |
148 | #define ERROR_COMPASS_VALUE 0x20 |
148 | #define ERROR_COMPASS_VALUE 0x20 |
149 | //---------------------------------------------------------------------------------------------------- |
149 | //---------------------------------------------------------------------------------------------------- |
150 | 150 | ||
151 | void CheckErrors(void) |
151 | void CheckErrors(void) |
152 | { |
152 | { |
153 | UART_VersionInfo.HardwareError[0] = 0; |
153 | UART_VersionInfo.HardwareError[0] = 0; |
154 | - | ||
155 | 154 | ||
156 | if((MK3MAG_Version.Compatible != MK3MAG_I2C_COMPATIBLE) || (CheckDelay(I2C1_Timeout)) || (MK3MAG_Version.Compatible != MK3MAG_I2C_COMPATIBLE) || (I2C_Heading.Heading < 0)) DebugOut.Status[1] |= 0x08; |
155 | if((MK3MAG_Version.Compatible != MK3MAG_I2C_COMPATIBLE) || CheckDelay(I2C1_Timeout) || (I2C_Heading.Heading < 0)) DebugOut.Status[1] |= 0x08; |
157 | else DebugOut.Status[1] &= ~0x08; // MK3Mag green status |
156 | else DebugOut.Status[1] &= ~0x08; // MK3Mag green status |
158 | 157 | ||
159 | if((FC_ErrorCode[1] & DEFEKT_I2C) || (FC_ErrorCode[1] & DEFEKT_BL_MISSING)) DebugOut.Status[1] |= 0x02; |
158 | if((FC_ErrorCode[1] & DEFEKT_I2C) || (FC_ErrorCode[1] & DEFEKT_BL_MISSING)) DebugOut.Status[1] |= 0x02; |
160 | else DebugOut.Status[1] &= ~0x02; // BL-Ctrl green status |
159 | else DebugOut.Status[1] &= ~0x02; // BL-Ctrl green status |
161 | 160 | ||
162 | if(CheckDelay(SPI0_Timeout)) |
161 | if(CheckDelay(SPI0_Timeout)) |
163 | { |
162 | { |
164 | LED_RED_ON; |
163 | LED_RED_ON; |
165 | sprintf(ErrorMSG,"no FC communication "); |
164 | sprintf(ErrorMSG,"no FC communication "); |
166 | ErrorCode = 3; |
165 | ErrorCode = 3; |
167 | StopNavigation = 1; |
166 | StopNavigation = 1; |
168 | DebugOut.Status[0] &= ~0x01; // status of FC Present |
167 | DebugOut.Status[0] &= ~0x01; // status of FC Present |
169 | DebugOut.Status[0] &= ~0x02; // status of BL Present |
168 | DebugOut.Status[0] &= ~0x02; // status of BL Present |
170 | UART_VersionInfo.HardwareError[0] |= ERROR_FC_COMMUNICATION; |
169 | UART_VersionInfo.HardwareError[0] |= ERROR_FC_COMMUNICATION; |
171 | } |
170 | } |
172 | else if(CheckDelay(I2C1_Timeout)) |
171 | else if(CheckDelay(I2C1_Timeout)) |
173 | { |
172 | { |
174 | LED_RED_ON; |
173 | LED_RED_ON; |
175 | sprintf(ErrorMSG,"no MK3Mag communication "); |
174 | sprintf(ErrorMSG,"no MK3Mag communication "); |
176 | //Reset I2CBus |
175 | //Reset I2CBus |
177 | I2C1_Deinit(); |
176 | I2C1_Deinit(); |
178 | I2C1_Init(); |
177 | I2C1_Init(); |
179 | ErrorCode = 4; |
178 | ErrorCode = 4; |
180 | StopNavigation = 1; |
179 | StopNavigation = 1; |
181 | UART_VersionInfo.HardwareError[0] |= ERROR_MK3_COMMUNICATION; |
180 | UART_VersionInfo.HardwareError[0] |= ERROR_MK3_COMMUNICATION; |
182 | DebugOut.Status[1] |= 0x08; |
181 | DebugOut.Status[1] |= 0x08; |
183 | } |
182 | } |
184 | else if(FC_Version.Compatible != FC_SPI_COMPATIBLE) |
183 | else if(FC_Version.Compatible != FC_SPI_COMPATIBLE) |
185 | { |
184 | { |
186 | LED_RED_ON; |
185 | LED_RED_ON; |
187 | sprintf(ErrorMSG,"FC not compatible "); |
186 | sprintf(ErrorMSG,"FC not compatible "); |
188 | ErrorCode = 1; |
187 | ErrorCode = 1; |
189 | StopNavigation = 1; |
188 | StopNavigation = 1; |
190 | UART_VersionInfo.HardwareError[0] |= ERROR_FC_INCOMPATIBLE; |
189 | UART_VersionInfo.HardwareError[0] |= ERROR_FC_INCOMPATIBLE; |
191 | } |
190 | } |
192 | 191 | ||
193 | else if(FC_ErrorCode[0] & DEFEKT_G_NICK) |
192 | else if(FC_ErrorCode[0] & DEFEKT_G_NICK) |
194 | { |
193 | { |
195 | LED_RED_ON; |
194 | LED_RED_ON; |
196 | sprintf(ErrorMSG,"ERR: FC Nick Gyro"); |
195 | sprintf(ErrorMSG,"ERR: FC Nick Gyro"); |
197 | ErrorCode = 10; |
196 | ErrorCode = 10; |
198 | } |
197 | } |
199 | else if(FC_ErrorCode[0] & DEFEKT_G_ROLL) |
198 | else if(FC_ErrorCode[0] & DEFEKT_G_ROLL) |
200 | { |
199 | { |
201 | LED_RED_ON; |
200 | LED_RED_ON; |
202 | sprintf(ErrorMSG,"ERR: FC Roll Gyro"); |
201 | sprintf(ErrorMSG,"ERR: FC Roll Gyro"); |
203 | ErrorCode = 11; |
202 | ErrorCode = 11; |
204 | } |
203 | } |
205 | else if(FC_ErrorCode[0] & DEFEKT_G_GIER) |
204 | else if(FC_ErrorCode[0] & DEFEKT_G_GIER) |
206 | { |
205 | { |
207 | LED_RED_ON; |
206 | LED_RED_ON; |
208 | sprintf(ErrorMSG,"ERR: FC Yaw Gyro"); |
207 | sprintf(ErrorMSG,"ERR: FC Yaw Gyro"); |
209 | ErrorCode = 12; |
208 | ErrorCode = 12; |
210 | } |
209 | } |
211 | else if(FC_ErrorCode[0] & DEFEKT_A_NICK) |
210 | else if(FC_ErrorCode[0] & DEFEKT_A_NICK) |
212 | { |
211 | { |
213 | LED_RED_ON; |
212 | LED_RED_ON; |
214 | sprintf(ErrorMSG,"ERR: FC Nick ACC"); |
213 | sprintf(ErrorMSG,"ERR: FC Nick ACC"); |
215 | ErrorCode = 13; |
214 | ErrorCode = 13; |
216 | } |
215 | } |
217 | else if(FC_ErrorCode[0] & DEFEKT_A_ROLL) |
216 | else if(FC_ErrorCode[0] & DEFEKT_A_ROLL) |
218 | { |
217 | { |
219 | LED_RED_ON; |
218 | LED_RED_ON; |
220 | sprintf(ErrorMSG,"ERR: FC Roll ACC"); |
219 | sprintf(ErrorMSG,"ERR: FC Roll ACC"); |
221 | ErrorCode = 14; |
220 | ErrorCode = 14; |
222 | } |
221 | } |
223 | else if(FC_ErrorCode[0] & DEFEKT_A_Z) |
222 | else if(FC_ErrorCode[0] & DEFEKT_A_Z) |
224 | { |
223 | { |
225 | LED_RED_ON; |
224 | LED_RED_ON; |
226 | sprintf(ErrorMSG,"ERR: FC Z-ACC"); |
225 | sprintf(ErrorMSG,"ERR: FC Z-ACC"); |
227 | ErrorCode = 15; |
226 | ErrorCode = 15; |
228 | } |
227 | } |
229 | else if(FC_ErrorCode[0] & DEFEKT_PRESSURE) |
228 | else if(FC_ErrorCode[0] & DEFEKT_PRESSURE) |
230 | { |
229 | { |
231 | LED_RED_ON; |
230 | LED_RED_ON; |
232 | sprintf(ErrorMSG,"ERR: Pressure sensor"); |
231 | sprintf(ErrorMSG,"ERR: Pressure sensor"); |
233 | ErrorCode = 16; |
232 | ErrorCode = 16; |
234 | } |
233 | } |
235 | else if(FC_ErrorCode[1] & DEFEKT_I2C) |
234 | else if(FC_ErrorCode[1] & DEFEKT_I2C) |
236 | { |
235 | { |
237 | LED_RED_ON; |
236 | LED_RED_ON; |
238 | sprintf(ErrorMSG,"ERR: FC I2C"); |
237 | sprintf(ErrorMSG,"ERR: FC I2C"); |
239 | ErrorCode = 17; |
238 | ErrorCode = 17; |
240 | } |
239 | } |
241 | else if(FC_ErrorCode[1] & DEFEKT_BL_MISSING) |
240 | else if(FC_ErrorCode[1] & DEFEKT_BL_MISSING) |
242 | { |
241 | { |
243 | LED_RED_ON; |
242 | LED_RED_ON; |
244 | sprintf(ErrorMSG,"ERR: Bl Missing"); |
243 | sprintf(ErrorMSG,"ERR: Bl Missing"); |
245 | ErrorCode = 18; |
244 | ErrorCode = 18; |
246 | } |
245 | } |
247 | else if(FC_ErrorCode[1] & DEFEKT_MIXER_ERR) |
246 | else if(FC_ErrorCode[1] & DEFEKT_MIXER_ERR) |
248 | { |
247 | { |
249 | LED_RED_ON; |
248 | LED_RED_ON; |
250 | sprintf(ErrorMSG,"Mixer Error"); |
249 | sprintf(ErrorMSG,"Mixer Error"); |
251 | ErrorCode = 19; |
250 | ErrorCode = 19; |
252 | } |
251 | } |
253 | else if(MK3MAG_Version.Compatible != MK3MAG_I2C_COMPATIBLE) |
252 | else if(MK3MAG_Version.Compatible != MK3MAG_I2C_COMPATIBLE) |
254 | { |
253 | { |
255 | sprintf(ErrorMSG,"MK3Mag not compatible "); |
254 | sprintf(ErrorMSG,"MK3Mag not compatible "); |
256 | LED_RED_ON; |
255 | LED_RED_ON; |
257 | ErrorCode = 2; |
256 | ErrorCode = 2; |
258 | StopNavigation = 1; |
257 | StopNavigation = 1; |
259 | UART_VersionInfo.HardwareError[0] |= ERROR_MK3_INCOMPATIBLE; |
258 | UART_VersionInfo.HardwareError[0] |= ERROR_MK3_INCOMPATIBLE; |
260 | } |
259 | } |
261 | else if(CheckDelay(UBX_Timeout)) |
260 | else if(CheckDelay(UBX_Timeout)) |
262 | { |
261 | { |
263 | LED_RED_ON; |
262 | LED_RED_ON; |
264 | sprintf(ErrorMSG,"no GPS communication "); |
263 | sprintf(ErrorMSG,"no GPS communication "); |
265 | ErrorCode = 5; |
264 | ErrorCode = 5; |
266 | StopNavigation = 1; |
265 | StopNavigation = 1; |
267 | UART_VersionInfo.HardwareError[0] |= ERROR_GPS_COMMUNICATION; |
266 | UART_VersionInfo.HardwareError[0] |= ERROR_GPS_COMMUNICATION; |
268 | } |
267 | } |
269 | else if(I2C_Heading.Heading < 0) |
268 | else if(I2C_Heading.Heading < 0) |
270 | { |
269 | { |
271 | LED_RED_ON; |
270 | LED_RED_ON; |
272 | sprintf(ErrorMSG,"bad compass value "); |
271 | sprintf(ErrorMSG,"bad compass value "); |
273 | ErrorCode = 6; |
272 | ErrorCode = 6; |
274 | StopNavigation = 1; |
273 | StopNavigation = 1; |
275 | UART_VersionInfo.HardwareError[0] |= ERROR_COMPASS_VALUE; |
274 | UART_VersionInfo.HardwareError[0] |= ERROR_COMPASS_VALUE; |
276 | } |
275 | } |
277 | else if(FC.Flags & FCFLAG_SPI_RX_ERR) |
276 | else if(FC.Flags & FCFLAG_SPI_RX_ERR) |
278 | { |
277 | { |
279 | LED_RED_ON; |
278 | LED_RED_ON; |
280 | sprintf(ErrorMSG,"FC spi rx error "); |
279 | sprintf(ErrorMSG,"FC spi rx error "); |
281 | ErrorCode = 8; |
280 | ErrorCode = 8; |
282 | StopNavigation = 1; |
281 | StopNavigation = 1; |
283 | } |
282 | } |
284 | else if(FC_ErrorCode[0] & DEFEKT_CAREFREE_ERR) |
283 | else if(FC_ErrorCode[0] & DEFEKT_CAREFREE_ERR) |
285 | { |
284 | { |
286 | LED_RED_ON; |
285 | LED_RED_ON; |
287 | sprintf(ErrorMSG,"FC: Carefree Error"); |
286 | sprintf(ErrorMSG,"FC: Carefree Error"); |
288 | ErrorCode = 20; |
287 | ErrorCode = 20; |
289 | } |
288 | } |
290 | else if(FC.RC_Quality < 100) |
289 | else if(FC.RC_Quality < 100) |
291 | { |
290 | { |
292 | LED_RED_ON; |
291 | LED_RED_ON; |
293 | sprintf(ErrorMSG,"RC Signal lost "); |
292 | sprintf(ErrorMSG,"RC Signal lost "); |
294 | ErrorCode = 7; |
293 | ErrorCode = 7; |
295 | } |
294 | } |
296 | else // no error occured |
295 | else // no error occured |
297 | { |
296 | { |
298 | sprintf(ErrorMSG,"No Error "); |
297 | sprintf(ErrorMSG,"No Error "); |
299 | ErrorCode = 0; |
298 | ErrorCode = 0; |
300 | StopNavigation = 0; |
299 | StopNavigation = 0; |
301 | LED_RED_OFF; |
300 | LED_RED_OFF; |
302 | } |
301 | } |
303 | if(UART_VersionInfo.HardwareError[0] || UART_VersionInfo.HardwareError[1] || UART_VersionInfo.HardwareError[0]) DebugOut.Status[1] |= 0x04; |
302 | if(UART_VersionInfo.HardwareError[0] || UART_VersionInfo.HardwareError[1]) DebugOut.Status[1] |= 0x04; |
304 | else DebugOut.Status[1] &= ~0x04; |
303 | else DebugOut.Status[1] &= ~0x04; |
305 | } |
304 | } |
306 | 305 | ||
307 | // the handler will be cyclic called by the timer 1 ISR |
306 | // the handler will be cyclic called by the timer 1 ISR |
308 | // used is for critical timing parts that normaly would handled |
307 | // used is for critical timing parts that normaly would handled |
309 | // within the main loop that could block longer at logging activities |
308 | // within the main loop that could block longer at logging activities |
310 | void EXTIT3_IRQHandler(void) |
309 | void EXTIT3_IRQHandler(void) |
311 | { |
310 | { |
312 | IENABLE; |
311 | IENABLE; |
313 | 312 | ||
314 | VIC_ITCmd(EXTIT3_ITLine,DISABLE); // disable irq |
313 | VIC_ITCmd(EXTIT3_ITLine,DISABLE); // disable irq |
315 | VIC_SWITCmd(EXTIT3_ITLine,DISABLE); // clear pending bit |
314 | VIC_SWITCmd(EXTIT3_ITLine,DISABLE); // clear pending bit |
316 | I2C1_UpdateCompass(); // update compass communication |
315 | I2C1_UpdateCompass(); // update compass communication |
317 | Analog_Update(); // get new ADC values |
316 | Analog_Update(); // get new ADC values |
318 | VIC_ITCmd(EXTIT3_ITLine, ENABLE); // enable irq |
317 | VIC_ITCmd(EXTIT3_ITLine, ENABLE); // enable irq |
319 | 318 | ||
320 | IDISABLE; |
319 | IDISABLE; |
321 | } |
320 | } |
322 | 321 | ||
323 | //---------------------------------------------------------------------------------------------------- |
322 | //---------------------------------------------------------------------------------------------------- |
324 | int main(void) |
323 | int main(void) |
325 | { |
324 | { |
326 | /* Configure the system clocks */ |
325 | /* Configure the system clocks */ |
327 | SCU_Config(); |
326 | SCU_Config(); |
328 | /* init VIC (Vectored Interrupt Controller) */ |
327 | /* init VIC (Vectored Interrupt Controller) */ |
329 | SCU_AHBPeriphClockConfig(__VIC,ENABLE); // enable AHB bus clock for VIC |
328 | SCU_AHBPeriphClockConfig(__VIC,ENABLE); // enable AHB bus clock for VIC |
330 | SCU_AHBPeriphReset(__VIC, DISABLE); // disable reset state for VIC |
329 | SCU_AHBPeriphReset(__VIC, DISABLE); // disable reset state for VIC |
331 | VIC_DeInit(); // deinitializes the VIC module registers to their default reset values. |
330 | VIC_DeInit(); // deinitializes the VIC module registers to their default reset values. |
332 | VIC_InitDefaultVectors(); |
331 | VIC_InitDefaultVectors(); |
333 | 332 | ||
334 | // initialize timer 1 for System Clock and delay rountines |
333 | // initialize timer 1 for System Clock and delay rountines |
335 | TIMER1_Init(); |
334 | TIMER1_Init(); |
336 | // initialize the LEDs (needs Timer 1) |
335 | // initialize the LEDs (needs Timer 1) |
337 | Led_Init(); |
336 | Led_Init(); |
338 | // initialize the debug UART1 |
337 | // initialize the debug UART1 |
339 | UART1_Init(); |
338 | UART1_Init(); |
340 | UART1_PutString("\r\n---------------------------------------------"); |
339 | UART1_PutString("\r\n---------------------------------------------"); |
341 | // initialize timer 2 for servo outputs |
340 | // initialize timer 2 for servo outputs |
342 | //TIMER2_Init(); |
341 | //TIMER2_Init(); |
343 | // initialize UART2 to FLIGHTCTRL |
342 | // initialize UART2 to FLIGHTCTRL |
344 | UART2_Init(); |
343 | UART2_Init(); |
345 | // initialize UART0 (to MKGPS or MK3MAG) |
344 | // initialize UART0 (to MKGPS or MK3MAG) |
346 | UART0_Init(); |
345 | UART0_Init(); |
347 | // initialize adc |
346 | // initialize adc |
348 | Analog_Init(); |
347 | Analog_Init(); |
349 | // initialize usb |
348 | // initialize usb |
350 | //USB_ConfigInit(); |
349 | //USB_ConfigInit(); |
351 | // initialize SPI0 to FC |
350 | // initialize SPI0 to FC |
352 | SPI0_Init(); |
351 | SPI0_Init(); |
353 | // initialize i2c bus to MK3MAG (needs Timer 1) |
352 | // initialize i2c bus to MK3MAG (needs Timer 1) |
354 | I2C_Heading.Heading = -1; |
353 | I2C_Heading.Heading = -1; |
355 | I2C1_Init(); |
354 | I2C1_Init(); |
356 | // initialize the gps position controller (needs Timer 1) |
355 | // initialize the gps position controller (needs Timer 1) |
357 | Fat16_Init(); |
356 | Fat16_Init(); |
358 | // initialize NC params |
357 | // initialize NC params |
359 | NCParams_Init(); |
358 | NCParams_Init(); |
360 | // initialize the settings |
359 | // initialize the settings |
361 | Settings_Init(); |
360 | Settings_Init(); |
362 | // initialize logging (needs settings) |
361 | // initialize logging (needs settings) |
363 | Logging_Init(); |
362 | Logging_Init(); |
364 | 363 | ||
365 | TimerCheckError = SetDelay(3000); |
364 | TimerCheckError = SetDelay(3000); |
366 | UART1_PutString("\r\n++++++++++++++++++++++++++++++++++++++++++"); |
365 | UART1_PutString("\r\n++++++++++++++++++++++++++++++++++++++++++"); |
367 | UART1_PutString("\n\r Version information:"); |
366 | UART1_PutString("\n\r Version information:"); |
368 | 367 | ||
369 | GetNaviCtrlVersion(); |
368 | GetNaviCtrlVersion(); |
370 | DebugOut.Status[0] = 0x04 | 0x08; // NC and MK3Mag |
369 | DebugOut.Status[0] = 0x04 | 0x08; // NC and MK3Mag |
371 | DebugOut.Status[1] = 0x00; |
370 | DebugOut.Status[1] = 0x00; |
372 | 371 | ||
373 | I2C1_GetMK3MagVersion(); |
372 | I2C1_GetMK3MagVersion(); |
374 | if(MK3MAG_Version.Compatible != MK3MAG_I2C_COMPATIBLE) |
373 | if(MK3MAG_Version.Compatible != MK3MAG_I2C_COMPATIBLE) |
375 | { |
374 | { |
376 | UART1_PutString("\n\r MK3Mag not compatible"); |
375 | UART1_PutString("\n\r MK3Mag not compatible"); |
377 | LED_RED_ON; |
376 | LED_RED_ON; |
378 | } |
377 | } |
379 | 378 | ||
380 | SPI0_GetFlightCtrlVersion(); |
379 | SPI0_GetFlightCtrlVersion(); |
381 | if(FC_Version.Compatible != FC_SPI_COMPATIBLE) |
380 | if(FC_Version.Compatible != FC_SPI_COMPATIBLE) |
382 | { |
381 | { |
383 | UART1_PutString("\n\r Flight-Ctrl not compatible"); |
382 | UART1_PutString("\n\r Flight-Ctrl not compatible"); |
384 | LED_RED_ON; |
383 | LED_RED_ON; |
385 | } |
384 | } |
386 | 385 | ||
387 | UART0_GetMKOSDVersion(); |
386 | UART0_GetMKOSDVersion(); |
388 | 387 | ||
389 | GPS_Init(); |
388 | GPS_Init(); |
390 | // initialize fat16 partition on sd card (needs Timer 1) |
389 | // initialize fat16 partition on sd card (needs Timer 1) |
391 | 390 | ||
392 | // ---------- Prepare the isr driven |
391 | // ---------- Prepare the isr driven |
393 | // set to absolute lowest priority |
392 | // set to absolute lowest priority |
394 | VIC_Config(EXTIT3_ITLine, VIC_IRQ, PRIORITY_SW); |
393 | VIC_Config(EXTIT3_ITLine, VIC_IRQ, PRIORITY_SW); |
395 | // enable interrupts |
394 | // enable interrupts |
396 | VIC_ITCmd(EXTIT3_ITLine, ENABLE); |
395 | VIC_ITCmd(EXTIT3_ITLine, ENABLE); |
397 | for (;;) // the endless main loop |
396 | for (;;) // the endless main loop |
398 | { |
397 | { |
399 | UART0_ProcessRxData(); // process request |
398 | UART0_ProcessRxData(); // process request |
400 | UART1_ProcessRxData(); // process request |
399 | UART1_ProcessRxData(); // process request |
401 | USB_ProcessRxData(); // process request |
400 | USB_ProcessRxData(); // process request |
402 | UART0_TransmitTxData(); // send answer |
401 | UART0_TransmitTxData(); // send answer |
403 | UART1_TransmitTxData(); // send answer |
402 | UART1_TransmitTxData(); // send answer |
404 | UART2_TransmitTxData(); // send answer |
403 | UART2_TransmitTxData(); // send answer |
405 | USB_TransmitTxData(); // send answer |
404 | USB_TransmitTxData(); // send answer |
406 | 405 | ||
407 | SPI0_UpdateBuffer(); // handle new SPI Data |
406 | SPI0_UpdateBuffer(); // handle new SPI Data |
408 | // ---------------- Error Check Timing ---------------------------- |
407 | // ---------------- Error Check Timing ---------------------------- |
409 | if(CheckDelay(TimerCheckError)) |
408 | if(CheckDelay(TimerCheckError)) |
410 | { |
409 | { |
411 | TimerCheckError = SetDelay(1000); |
410 | TimerCheckError = SetDelay(1000); |
412 | if(CheckDelay(SPI0_Timeout)) GPS_Navigation(&GPSData, &(ToFlightCtrl.GPSStick)); // process the GPS data even if the FC is not connected |
411 | if(CheckDelay(SPI0_Timeout)) GPS_Navigation(&GPSData, &(ToFlightCtrl.GPSStick)); // process the GPS data even if the FC is not connected |
413 | CheckErrors(); |
412 | CheckErrors(); |
414 | if(FC.Flags & FCFLAG_FLY) NaviData.FlyingTime++; // we want to count the battery-time |
413 | if(FC.Flags & FCFLAG_FLY) NaviData.FlyingTime++; // we want to count the battery-time |
415 | // else NaviData.FlyingTime = 0; // not the time per flight |
414 | // else NaviData.FlyingTime = 0; // not the time per flight |
416 | if(SerialLinkOkay) SerialLinkOkay--; |
415 | if(SerialLinkOkay) SerialLinkOkay--; |
417 | if(SerialLinkOkay < 250 - 5) NCFlags |= NC_FLAG_NOSERIALLINK; // 5 seconds timeout for serial communication |
416 | if(SerialLinkOkay < 250 - 5) NCFlags |= NC_FLAG_NOSERIALLINK; // 5 seconds timeout for serial communication |
418 | else NCFlags &= ~NC_FLAG_NOSERIALLINK; |
417 | else NCFlags &= ~NC_FLAG_NOSERIALLINK; |
419 | if(StopNavigation && (Parameter.NaviGpsModeControl >= 50)) BeepTime = 1000; |
418 | if(StopNavigation && (Parameter.NaviGpsModeControl >= 50)) BeepTime = 1000; |
420 | } |
419 | } |
421 | // ---------------- Logging --------------------------------------- |
420 | // ---------------- Logging --------------------------------------- |
422 | Logging_Update(); // could be block some time for at max. 2 seconds, therefore move time critical part of the mainloop into the ISR of timer 1 |
421 | Logging_Update(); // could be block some time for at max. 2 seconds, therefore move time critical part of the mainloop into the ISR of timer 1 |
423 | } |
422 | } |
424 | } |
423 | } |
425 | 424 | ||
426 | 425 | ||
427 | 426 |