annotate Discovery/Src/tDebug.c @ 67:9714e1f0dea0

Bugfix: FutureTTS and Fahrenheit not displayed correct
author Ideenmodellierer
date Wed, 22 Aug 2018 11:35:05 +0200
parents 5f11787b4f42
children 717f335cc5c9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 /// -*- coding: UTF-8 -*-
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 /// \file Discovery/Src/tDebug.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief Screen with Terminal Out
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /// \author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /// \date 06-April-2016
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 /// \details
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 /// $Id$
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 /// This program is free software: you can redistribute it and/or modify
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 /// it under the terms of the GNU General Public License as published by
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 /// the Free Software Foundation, either version 3 of the License, or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 /// (at your option) any later version.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /// This program is distributed in the hope that it will be useful,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 /// GNU General Public License for more details.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 /// You should have received a copy of the GNU General Public License
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 //////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 #include "tDebug.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #include "data_exchange_main.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 #include "gfx_engine.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 #include "gfx_fonts.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 #include "ostc.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 #include "tInfo.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 #include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 #include <string.h>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 uint8_t tD_selection_page = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 uint8_t tD_debugModeActive = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 uint8_t tD_status = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 char tD_communication[6][40];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 void tDebug_Action(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 void tDebug_NextPage(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 void setDebugMode(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 tD_debugModeActive = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 void exitDebugMode(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 MX_Bluetooth_PowerOff();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 settingsGetPointer()->debugModeOnStart = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 tD_debugModeActive = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 uint8_t inDebugMode(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 return tD_debugModeActive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 if(settingsGetPointer()->showDebugInfo == 2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 return 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 return 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 void tDebug_start(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 MX_Bluetooth_PowerOn();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 tD_debugModeActive = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 tD_status = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 for(int i=0;i<6;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 tD_communication[i][0] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 set_globalState(StIDEBUG);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 void tDebugControl(uint8_t sendAction)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 switch(sendAction)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 case ACTION_BUTTON_ENTER:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 tDebug_Action();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 case ACTION_BUTTON_NEXT:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 tDebug_NextPage();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 case ACTION_TIMEOUT:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 case ACTION_MODE_CHANGE:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 case ACTION_BUTTON_BACK:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 exitInfo();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 default:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 case ACTION_IDLE_TICK:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 case ACTION_IDLE_SECOND:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 void tDebug_refresh(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 uint8_t color;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 char text[50];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 tInfo_write_content_simple( 700,780, 20, &FontT24, "\0021/1", CLUT_NiceGreen);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 tInfo_write_content_simple( 20,780, 20, &FontT24, "Debug Terminal", CLUT_NiceGreen);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 snprintf(text,50,"X: %i Y: %i Z: %i %03.0f %03.0f"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 ,stateUsed->lifeData.compass_DX_f
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 ,stateUsed->lifeData.compass_DY_f
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 ,stateUsed->lifeData.compass_DZ_f
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 ,stateUsed->lifeData.compass_roll
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 ,stateUsed->lifeData.compass_pitch
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 snprintf(text,50,"roll %.0f pitch %.0f"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 ,stateUsed->lifeData.compass_roll
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 ,stateUsed->lifeData.compass_pitch
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 tInfo_write_content_simple( 20,780, 60, &FontT24, text, CLUT_NiceGreen);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 for(int i=0;i<6;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 if(i%2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 color = CLUT_WarningRed;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 color = CLUT_WarningYellow;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 tInfo_write_content_simple( 20,780, (60*i)+100, &FontT42, tD_communication[i], color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 void tDebug_NextPage(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 void tDebug_helper_replaceCRLF(char *text, uint8_t maxlength)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 for(int i=0; i<maxlength; i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 if(text[i] == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 if((text[i] == '\r') || (text[i] == '\n'))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 text[i] = ' ';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 void tDebug_Action(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 char aRxBuffer[50];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 char aTxBufferEscapeSequence[4] = "+++";
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 char aTxBufferName[22] = "AT+BNAME=OSTC4-12345\r";
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 char aTxBufferWrite[6] = "AT&W\r";
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 gfx_number_to_string(5,1,&aTxBufferName[15],hardwareDataGetPointer()->primarySerial);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 tD_status++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 switch(tD_status)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 case 1:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBufferEscapeSequence, 3, 2000) == HAL_OK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 strcpy(tD_communication[0],aTxBufferEscapeSequence);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 strcpy(tD_communication[0],"Error.");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 if(HAL_UART_Receive(&UartHandle, (uint8_t*)aRxBuffer, 3, 2000) == HAL_OK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 aRxBuffer[3] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 tDebug_helper_replaceCRLF(aRxBuffer, 3);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 strcpy(tD_communication[1],aRxBuffer);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 strcpy(tD_communication[1],"Error.");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 case 2:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBufferName, 21, 2000) == HAL_OK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 strcpy(tD_communication[2],aTxBufferName);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 strcpy(tD_communication[2],"Error.");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 if(HAL_UART_Receive(&UartHandle, (uint8_t*)aRxBuffer, 21+6, 2000) == HAL_OK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 aRxBuffer[21+6] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 tDebug_helper_replaceCRLF(aRxBuffer, 21+6);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 strcpy(tD_communication[3],aRxBuffer);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 strcpy(tD_communication[3],"Error.");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 case 3:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBufferWrite, 5, 2000) == HAL_OK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 strcpy(tD_communication[4],aTxBufferWrite);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 strcpy(tD_communication[4],"Error.");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 if(HAL_UART_Receive(&UartHandle, (uint8_t*)aRxBuffer, 5+6, 2000) == HAL_OK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 aRxBuffer[5+6] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 tDebug_helper_replaceCRLF(aRxBuffer, 5+6);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 strcpy(tD_communication[5],aRxBuffer);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 strcpy(tD_communication[5],"Error.");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 default:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 tD_status = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255