Rev 13 | Rev 15 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 13 | Rev 14 | ||
---|---|---|---|
Line 61... | Line 61... | ||
61 | { -1, -1 }; // if more than one sensor this will be printed |
61 | { -1, -1 }; // if more than one sensor this will be printed |
62 | int16_t dial0[2] = |
62 | int16_t dial0[2] = |
63 | { 0, 0 }; |
63 | { 0, 0 }; |
64 | int16_t dial1[2] = |
64 | int16_t dial1[2] = |
65 | { -1, -1 }; |
65 | { -1, -1 }; |
- | 66 | ||
- | 67 | ||
66 | union |
68 | union |
67 | { |
69 | { |
68 | PLX_SensorInfo Sensor[MAXRDG]; |
70 | PLX_SensorInfo Sensor[MAXRDG]; |
69 | char Bytes[MAXRDG * sizeof(PLX_SensorInfo)]; |
71 | char Bytes[MAXRDG * sizeof(PLX_SensorInfo)]; |
70 | } Data; |
72 | } Data; |
Line 104... | Line 106... | ||
104 | { |
106 | { |
105 | char buff[10]; |
107 | char buff[10]; |
106 | int i; |
108 | int i; |
107 | select_display(dial); // pick the display we are using |
109 | select_display(dial); // pick the display we are using |
108 | int ItemIndex = dial_pos[dial]/4; |
110 | int ItemIndex = dial_pos[dial]/4; |
- | 111 | ||
109 | // wrap around count if dial too far to the right |
112 | // wrap around count if dial too far to the right |
110 | if (ItemIndex >= PLXItems) |
113 | if (ItemIndex >= PLXItems) |
111 | { |
114 | { |
112 | dial_pos[dial] = 0; |
115 | dial_pos[dial] = 0; |
113 | ItemIndex = 0; |
116 | ItemIndex = 0; |
114 | } |
117 | } |
115 | if (ItemIndex < 0) |
118 | if (ItemIndex < 0) |
116 | { |
119 | { |
117 | ItemIndex = 0; |
120 | ItemIndex = PLXItems-1; |
118 | dial_pos[dial] = 0; |
121 | dial_pos[dial] = (PLXItems-1)*4; |
119 | } |
122 | } |
120 | 123 | ||
121 | 124 | ||
122 | 125 | ||
123 | // check for item suppression |
126 | // check for item suppression |
Line 156... | Line 159... | ||
156 | if (Observation < PLX_MAX_OBS) |
159 | if (Observation < PLX_MAX_OBS) |
157 | { |
160 | { |
158 | if (Observation != OldObservation[dial] |
161 | if (Observation != OldObservation[dial] |
159 | || ObservationIndex != OldObservationIndex[dial]) |
162 | || ObservationIndex != OldObservationIndex[dial]) |
160 | { |
163 | { |
- | 164 | ||
- | 165 | ||
161 | dial1[dial] = -1; |
166 | dial1[dial] = -1; |
162 | clearDisplay(); |
167 | clearDisplay(); |
163 | dial_draw_scale( |
168 | dial_draw_scale( |
164 | DisplayInfo[Observation].Low, |
169 | DisplayInfo[Observation].Low, |
165 | DisplayInfo[Observation].High, |
170 | DisplayInfo[Observation].High, |
166 | 12, 1,DisplayInfo[Observation].TickScale); |
171 | 12, 1,DisplayInfo[Observation].TickScale); |
- | 172 | ||
167 | if (ObservationIndex > 0) |
173 | msg = DisplayInfo[Observation].name; |
168 | { |
- | |
169 | len = 5; |
174 | len = 7; |
170 | buff[6] = ObservationIndex + '1'; |
175 | int len1 = ObservationIndex > 0 ? len-1: len; |
171 | } |
- | |
172 | else |
176 | for (i = 0; i < len1 && msg[i]; i++) |
173 | { |
177 | { |
174 | len = 6; |
178 | buff[i] = msg[i]; |
175 | } |
179 | } |
- | 180 | if (ObservationIndex > 0 && i<len) |
|
176 | { |
181 | { |
177 | msg = DisplayInfo[Observation].name; |
182 | buff[i++] = ObservationIndex + '1'; |
178 | } |
183 | } |
179 | for (i = 0; i < len; i++) |
184 | for(;i<len;i++) |
180 | { |
185 | { |
181 | buff[i] = msg[i]; |
186 | buff[i]=' '; |
182 | } |
187 | } |
- | 188 | ||
183 | print_large_string(buff, 32, 48, 6); // this prints spaces for \0 at end of string |
189 | print_large_string(buff, 32, 48, len); // this prints spaces for \0 at end of string |
184 | 190 | ||
185 | OldObservation[dial] = Observation; |
191 | OldObservation[dial] = Observation; |
186 | OldObservationIndex[dial] = ObservationIndex; |
192 | OldObservationIndex[dial] = ObservationIndex; |
187 | // |
193 | // |
188 | display(); |
194 | display(); |
Line 289... | Line 295... | ||
289 | MX_GPIO_Init(); |
295 | MX_GPIO_Init(); |
290 | MX_SPI1_Init(); |
296 | MX_SPI1_Init(); |
291 | MX_USART2_UART_Init(); |
297 | MX_USART2_UART_Init(); |
292 | MX_USART1_UART_Init(); |
298 | MX_USART1_UART_Init(); |
293 | 299 | ||
- | 300 | #if 0 |
|
294 | /* USER CODE BEGIN 2 */ |
301 | /* USER CODE BEGIN 2 */ |
295 | /* Need to set AF mode for output pins DURR. */ |
302 | /* Need to set AF mode for output pins DURR. */ |
296 | /* SPI bus AF pin selects */ |
303 | /* SPI bus AF pin selects */ |
297 | GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; |
304 | GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; |
298 | 305 | ||
Line 306... | Line 313... | ||
306 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
313 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
307 | 314 | ||
308 | /* USART1 AF pin selects */ |
315 | /* USART1 AF pin selects */ |
309 | GPIO_InitStruct.Pin = GPIO_PIN_9; |
316 | GPIO_InitStruct.Pin = GPIO_PIN_9; |
310 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
317 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
311 | 318 | #endif |
|
312 | /* Turn on USART2 IRQ */ |
319 | /* Turn on USART2 IRQ */ |
313 | HAL_NVIC_SetPriority(USART2_IRQn, 4, 0); |
320 | HAL_NVIC_SetPriority(USART2_IRQn, 4, 0); |
314 | HAL_NVIC_EnableIRQ(USART2_IRQn); |
321 | HAL_NVIC_EnableIRQ(USART2_IRQn); |
315 | 322 | ||
316 | /* Turn on USART1 IRQ */ |
323 | /* Turn on USART1 IRQ */ |
Line 331... | Line 338... | ||
331 | ssd1306_begin(1, 0); |
338 | ssd1306_begin(1, 0); |
332 | dial_origin(64, 60); |
339 | dial_origin(64, 60); |
333 | dial_size(60); |
340 | dial_size(60); |
334 | 341 | ||
335 | 342 | ||
- | 343 | ||
336 | for (disp = 0; disp < 2; disp++) |
344 | for (disp = 0; disp < 2; disp++) |
337 | { |
345 | { |
338 | select_display(disp); |
346 | select_display(disp); |
339 | clearDisplay(); |
347 | clearDisplay(); |
340 | dim(0); |
348 | dim(0); |
Line 412... | Line 420... | ||
412 | Min[i] = DataVal; |
420 | Min[i] = DataVal; |
413 | } |
421 | } |
414 | } |
422 | } |
415 | 423 | ||
416 | // now to display the information |
424 | // now to display the information |
417 | int suppress = DisplayCurrent(0,-1); |
425 | int suppress = DisplayCurrent(0,-1); |
418 | DisplayCurrent(1,suppress); |
426 | DisplayCurrent(1, suppress); |
419 | } |
427 | } |
420 | PLXPtr = 0; |
428 | PLXPtr = 0; |
421 | PLXPacket = 0; |
429 | PLXPacket = 0; |
422 | } |
430 | } |
423 | else if (c > PLX_Stop) // illegal char, restart reading |
431 | else if (c > PLX_Stop) // illegal char, restart reading |