changeset 120:6347a86caa18 FlipDisplay

Cleanup warning and disable printf calls
author Ideenmodellierer
date Tue, 08 Jan 2019 22:31:17 +0100
parents 76fa42fc0b20
children 0d97971b771b
files Small_CPU/Src/baseCPU2.c Small_CPU/Src/scheduler.c Small_CPU/Src/spi.c
diffstat 3 files changed, 40 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Small_CPU/Src/baseCPU2.c	Sun Jan 06 22:33:26 2019 +0100
+++ b/Small_CPU/Src/baseCPU2.c	Tue Jan 08 22:31:17 2019 +0100
@@ -278,8 +278,21 @@
  * @param  None
  * @retval None
  */
+/* #define DEBUG_RUNTIME TRUE */
+#ifdef DEBUG_RUNTIME
+#define MEASURECNT 60	/* number of measuremets to be stored */
+static uint32_t loopcnt[MEASURECNT];
+extern RTC_HandleTypeDef RTCHandle;
+#endif
 
 int main(void) {
+
+#ifdef DEBUG_RUNTIME
+    RTC_TimeTypeDef Stime;
+    uint8_t measurementindex = 0;
+    uint8_t lastsecond = 0xFF;
+#endif
+
 	HAL_Init();
 	SystemClock_Config();
 
@@ -292,7 +305,7 @@
 	GPIO_new_DEBUG_Init(); // added 170322 hw
 	initGlobals();
 
-	printf("CPU2-RTE running...\n");
+/*	printf("CPU2-RTE running...\n"); */
 
 	MX_I2C1_Init();
 	if (global.I2C_SystemStatus != HAL_OK) {
@@ -352,7 +365,7 @@
 	global.mode = MODE_TEST;
 #endif
 	while (1) {
-		printf("Global mode = %d\n", global.mode);
+/*		printf("Global mode = %d\n", global.mode); */
 
 		switch (global.mode) {
 		case MODE_POWERUP:
@@ -475,6 +488,27 @@
 			// EXTILine0_Button_DeInit(); not now, later after testing
 			break;
 		}
+
+#ifdef DEBUG_RUNTIME
+		HAL_RTC_GetTime(&RTCHandle, &Stime, RTC_FORMAT_BCD);
+
+        if(lastsecond == 0xFF)
+        {
+        	measurementindex = 0;
+        	loopcnt[measurementindex] = 0;
+        	lastsecond = Stime.Seconds;
+        }
+        loopcnt[measurementindex]++;
+
+        if(lastsecond != Stime.Seconds)
+        {
+        	measurementindex++;
+        	if (measurementindex == MEASURECNT) measurementindex = 0;
+        	loopcnt[measurementindex] = 0;
+        	lastsecond = Stime.Seconds;
+        	if(measurementindex +1 < MEASURECNT) loopcnt[measurementindex +1] = 0xffff;	/* helps to identify the latest value */
+        }
+#endif
 	}
 }
 
--- a/Small_CPU/Src/scheduler.c	Sun Jan 06 22:33:26 2019 +0100
+++ b/Small_CPU/Src/scheduler.c	Tue Jan 08 22:31:17 2019 +0100
@@ -778,7 +778,7 @@
 
 	while(global.mode == MODE_SURFACE)
 	{
-	    printf("surface...\n");
+	/*    printf("surface...\n"); */
 //	    SPI_Start_single_TxRx_with_Master();
 		schedule_check_resync();
 		lasttick = HAL_GetTick();
--- a/Small_CPU/Src/spi.c	Sun Jan 06 22:33:26 2019 +0100
+++ b/Small_CPU/Src/spi.c	Tue Jan 08 22:31:17 2019 +0100
@@ -21,13 +21,16 @@
 
 /* Includes ------------------------------------------------------------------*/
 #include "spi.h"
+#include "dma.h"
 //#include "gpio.h"
 
 /* USER CODE BEGIN 0 */
 #include "scheduler.h"
 
+#ifdef DEBUG_GPIO
 extern void GPIO_new_DEBUG_LOW(void);
 extern void GPIO_new_DEBUG_HIGH(void);
+#endif
 
 uint8_t data_error = 0;
 uint32_t data_error_time = 0;