Skip to content

Commit c98b01b

Browse files
committed
fix: printing error
1 parent fdb56b6 commit c98b01b

File tree

1 file changed

+5
-7
lines changed
  • obc/examples/test_app_cc1120_temp

1 file changed

+5
-7
lines changed

obc/examples/test_app_cc1120_temp/main.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "obc_logging.h"
22
#include "obc_sci_io.h"
33
#include "obc_spi_io.h"
4+
#include "obc_print.h"
45
#include "cc1120.h"
56

67
#include "FreeRTOS.h"
@@ -12,7 +13,6 @@
1213
#include <sci.h>
1314
#include <spi.h>
1415
#include <stdio.h>
15-
#include <string.h>
1616

1717
static TaskHandle_t testTaskHandle = NULL;
1818
static StaticTask_t testTaskBuffer;
@@ -31,34 +31,32 @@ void initTestTask(void) {
3131
static void vTestTask(void* pvParameters) {
3232
float temperature;
3333
obc_error_code_t err;
34-
char tempStr[32];
3534

3635
// Initialize CC1120
3736
err = cc1120Init();
3837
if (err != OBC_ERR_CODE_SUCCESS) {
39-
printTextSci(scilinREG, "cc1120Init failed\r\n", 20);
38+
sciPrintf("cc1120Init failed\r\n");
4039
return;
4140
}
4241

4342
// Read temperature every 5 seconds
4443
while (1) {
4544
err = cc1120ReadTemp(&temperature);
4645
if (err == OBC_ERR_CODE_SUCCESS) {
47-
snprintf(tempStr, sizeof(tempStr), "CC1120 temperature: %.2f C\r\n", temperature);
48-
printTextSci(scilinREG, tempStr, strlen(tempStr));
46+
sciPrintf("CC1120 temperature: %.2f C\r\n", temperature);
4947
} else {
50-
printTextSci(scilinREG, "Failed to read temperature\r\n", 29);
48+
sciPrintf("Failed to read temperature\r\n");
5149
}
5250
vTaskDelay(pdMS_TO_TICKS(5000));
5351
}
5452
}
5553

5654
int main(void) {
57-
initSciMutex();
5855
gioInit();
5956
sciInit();
6057
spiInit();
6158
adcInit();
59+
initSciPrint();
6260

6361
// Initialize logger
6462
// initLogger();

0 commit comments

Comments
 (0)