-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed sending message from PC / Fix for ENABLE_MESSENGER_UART #120
Changes from 4 commits
bfe941d
d6b86fe
faa0ef2
518debd
5b9d0b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
#include "bsp/dp32g030/syscon.h" | ||
#include "bsp/dp32g030/uart.h" | ||
#include "driver/uart.h" | ||
#include "external/printf/printf.h" | ||
|
||
static bool UART_IsLogEnabled; | ||
uint8_t UART_DMA_Buffer[256]; | ||
|
@@ -102,3 +103,16 @@ void UART_LogSend(const void *pBuffer, uint32_t Size) | |
UART_Send(pBuffer, Size); | ||
} | ||
} | ||
|
||
void UART_printf(const char *str, ...) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we reuse There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not for debug, but for send/recv via serial port. I think it should not be mixed. |
||
{ | ||
char text[256]; | ||
int len; | ||
|
||
va_list va; | ||
va_start(va, str); | ||
len = vsnprintf(text, sizeof(text), str, va); | ||
va_end(va); | ||
|
||
UART_Send(text, len); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
#include "settings.h" | ||
#include "ui/helper.h" | ||
|
||
void UI_DisplayFM(void) | ||
void UI_DisplayFM_text(char *text) | ||
{ | ||
char String[16]; | ||
|
||
|
@@ -38,15 +38,20 @@ void UI_DisplayFM(void) | |
UI_PrintString(String, 0, 127, 0, 12); | ||
|
||
memset(String, 0, sizeof(String)); | ||
|
||
strcpy(String, text); | ||
UI_PrintString(String, 0, 127, 2, 10); | ||
|
||
memset(String, 0, sizeof(String)); | ||
|
||
sprintf(String, "%3d.%d", gEeprom.FM_FrequencyPlaying / 10, gEeprom.FM_FrequencyPlaying % 10); | ||
UI_DisplayFrequency(String, 32, 4, true); | ||
UI_DisplayFrequency(String, 32, 4, true); | ||
|
||
ST7565_BlitFullScreen(); | ||
} | ||
|
||
void UI_DisplayFM(void) | ||
{ | ||
UI_DisplayFM_text(""); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whereas I like this improvement, the implementation is not slim with the wrapper function approach. And considering we're at 99% mark of space utilization it is quite important. It could be rewritten to use a global boolean (which probably is already defined, but not used) to indicate scan in progress and then the ui function can determine whether or not display |
||
} | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,8 +18,8 @@ | |
#define UI_FM_H | ||
|
||
#ifdef ENABLE_FMRADIO | ||
void UI_DisplayFM_text(char*); | ||
void UI_DisplayFM(void); | ||
#endif | ||
|
||
#endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this refactor. Good job!