modified the scope function

This commit is contained in:
Niklas Fauth
2018-02-09 10:11:46 +01:00
parent a86574bcea
commit 10da0983c6
4 changed files with 207 additions and 185 deletions

View File

@@ -8,19 +8,24 @@
UART_HandleTypeDef huart2;
volatile uint8_t uart_buf[300];
volatile int16_t ch_buf[8];
//volatile char char_buf[300];
void consoleScope(int16_t ch0, int16_t ch1, int16_t ch2, int16_t ch3, int16_t ch4, int16_t ch5, int16_t ch6, int16_t ch7) {
void setScopeChannel(uint8_t ch, int16_t val) {
ch_buf[ch] = val;
}
void consoleScope() {
#ifdef DEBUG_SERIAL_SERVOTERM
uart_buf[0] = 0xff;
uart_buf[1] = CLAMP(ch0+127, 0, 255);
uart_buf[2] = CLAMP(ch1+127, 0, 255);
uart_buf[3] = CLAMP(ch2+127, 0, 255);
uart_buf[4] = CLAMP(ch3+127, 0, 255);
uart_buf[5] = CLAMP(ch4+127, 0, 255);
uart_buf[6] = CLAMP(ch5+127, 0, 255);
uart_buf[7] = CLAMP(ch6+127, 0, 255);
uart_buf[8] = CLAMP(ch7+127, 0, 255);
uart_buf[1] = CLAMP(ch_buf[0]+127, 0, 255);
uart_buf[2] = CLAMP(ch_buf[1]+127, 0, 255);
uart_buf[3] = CLAMP(ch_buf[2]+127, 0, 255);
uart_buf[4] = CLAMP(ch_buf[3]+127, 0, 255);
uart_buf[5] = CLAMP(ch_buf[4]+127, 0, 255);
uart_buf[6] = CLAMP(ch_buf[5]+127, 0, 255);
uart_buf[7] = CLAMP(ch_buf[6]+127, 0, 255);
uart_buf[8] = CLAMP(ch_buf[7]+127, 0, 255);
uart_buf[9] = '\n';
if(DMA1_Channel2->CNDTR == 0) {
@@ -33,7 +38,7 @@ void consoleScope(int16_t ch0, int16_t ch1, int16_t ch2, int16_t ch3, int16_t ch
#ifdef DEBUG_SERIAL_ASCII
memset(&uart_buf, 0, sizeof(uart_buf));
sprintf(uart_buf, "%i;%i;%i;%i;%i;%i;%i;%i\n\r", ch0, ch1, ch2, ch3, ch4, ch5, ch6, ch7);
sprintf(uart_buf, "%i;%i;%i;%i;%i;%i;%i;%i\n\r", ch_buf[0], ch_buf[1], ch_buf[2], ch_buf[3], ch_buf[4], ch_buf[5], ch_buf[6], ch_buf[7]);
if(DMA1_Channel2->CNDTR == 0) {
DMA1_Channel2->CCR &= ~DMA_CCR_EN;