Skip to content

Commit 989f045

Browse files
committed
fully migrated to newest esp-idf
1 parent 5273812 commit 989f045

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
idf_component_register(SRCS "src/pcd8544.c" "src/pcd8544_pin.c"
22
INCLUDE_DIRS "src"
3+
REQUIRES driver
34
)

main/Tasks/screen_pcd8544/pcd8544_font_utils.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include <pcd8544_font_utils.h>
22

33
#include "esp_log.h"
4+
// @TODO better bigCharPositions types!
5+
46
/**
57
* @param charArr array of chars to which font data will be passed
68
* @param buffer source of text
@@ -11,26 +13,26 @@
1113
* @TODO validate string, skip special chars, cleanup array sizes!
1214
* @TODO dynamic rows number calculation
1315
* */
14-
static void fillCharsFromBuffer(uint8_t **charArr, char *buffer, int nrOfChars, uint8_t (*bigCharPositions)[6]) {
16+
static void fillCharsFromBuffer(uint8_t **charArr, char *buffer, int nrOfChars, uint8_t bigCharPositions[6]) {
1517
for (int i = 0; i <= nrOfChars; i++) {
1618
// convert to int and fill charArr with pointers to big font characters
1719
if (*buffer != '.' && *buffer >= '0' && *buffer <= '9') {
1820
char single_char_buf[1] = {*buffer};
1921
*charArr = fontDetermination[atoi(single_char_buf)];
20-
(*bigCharPositions)[i] = 16;
22+
bigCharPositions[i] = 16;
2123
} else if (*buffer == '.') {
2224
*charArr = fontDetermination[10];
23-
(*bigCharPositions)[i] = 3;
25+
bigCharPositions[i] = 3;
2426
} else {
2527
*charArr = NULL;
26-
(*bigCharPositions)[i] = 0;
28+
bigCharPositions[i] = 0;
2729
}
2830
buffer++;
2931
charArr++;
3032
}
3133
}
3234

33-
void vGetSpeedChars(uint8_t *charArr[4], float *speed, uint8_t (*bigCharPositions)[6]) {
35+
void vGetSpeedChars(uint8_t *charArr[4], float *speed, uint8_t *bigCharPositions) {
3436
// create buffer for converted float
3537
char buffer[10];
3638
// prevent overflow
@@ -48,10 +50,10 @@ void vGetSpeedChars(uint8_t *charArr[4], float *speed, uint8_t (*bigCharPosition
4850
} else {
4951
snprintf(buffer, 10, "%d.%d", speedInt, fraction);
5052
}
51-
fillCharsFromBuffer(charArr, buffer, 4, &bigCharPositions);
53+
fillCharsFromBuffer(charArr, buffer, 4, bigCharPositions);
5254
}
5355

54-
void vGetDistanceChars(uint8_t *charArr[6], float *distance, uint8_t (*bigCharPositions)[6]) {
56+
void vGetDistanceChars(uint8_t *charArr[6], float *distance, uint8_t *bigCharPositions) {
5557
char buffer[10];
5658
// @TODO handle distance > 999.9
5759
// @TODO handle distance > 99.99
@@ -64,5 +66,5 @@ void vGetDistanceChars(uint8_t *charArr[6], float *distance, uint8_t (*bigCharPo
6466
} else {
6567
snprintf(buffer, 10, "%d.%d", distanceInt, fraction);
6668
}
67-
fillCharsFromBuffer(charArr, buffer, 10, &bigCharPositions);
69+
fillCharsFromBuffer(charArr, buffer, 10, bigCharPositions);
6870
}

main/Tasks/screen_pcd8544/pcd8544_font_utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
* @param charRowsArr pointer to empty array, which will be filled with next chars row number
1313
* @return pointer to array of binary characters
1414
* */
15-
void vGetSpeedChars(uint8_t *charArr[4], float *speed, uint8_t (*bigCharPositions)[6]);
15+
void vGetSpeedChars(uint8_t *charArr[4], float *speed, uint8_t *bigCharPositions);
1616

1717
/**
1818
* @brief convert distance measured from float to included font char array
1919
* @param charRowsArr pointer to empty array, which will be filled with next chars row number
2020
* @return pointer to array of binary characters
2121
* */
22-
void vGetDistanceChars(uint8_t *charArr[6], float *distance, uint8_t (*bigCharPositions)[6]);
22+
void vGetDistanceChars(uint8_t *charArr[6], float *distance, uint8_t *bigCharPositions);
2323

2424
#endif

main/Tasks/screen_pcd8544/screen_pcd8544.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static void drawAverageBar() {
6060
static void vDrawMainSpeed() {
6161
uint8_t *speedChars[4];
6262
uint8_t currentDrawingPos = 0;
63-
vGetSpeedChars(speedChars, &rideParams.speed, &bigCharPositions);
63+
vGetSpeedChars(speedChars, &rideParams.speed, bigCharPositions);
6464
for (int i = 0; i < 4; i++) {
6565
pcd8544_set_pos(currentDrawingPos, 0);
6666
pcd8544_draw_bitmap(speedChars[i], bigCharPositions[i], 3, true);
@@ -72,7 +72,7 @@ static void vDrawMainDistance() {
7272
uint8_t *distanceChars[6];
7373
uint8_t currentDrawingPos = 0;
7474
currentDrawingPos = 0;
75-
vGetDistanceChars(distanceChars, &rideParams.distance, &bigCharPositions);
75+
vGetDistanceChars(distanceChars, &rideParams.distance, bigCharPositions);
7676
for (int i = 0; i < 6; i++) {
7777
if (distanceChars[i] == 0) {
7878
break;

main/wifi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static void wifi_event_handler(void* arg, esp_event_base_t event_base, int32_t e
3737
ESP_LOGI(TAG, "connect to the AP fail");
3838
} else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
3939
ip_event_got_ip_t* event = (ip_event_got_ip_t*)event_data;
40-
ESP_LOGI(TAG, "got ip:%s", esp_ip4addr_ntoa(&event->ip_info.ip));
40+
ESP_LOGI(TAG, "got ip:" IPSTR, IP2STR(&event->ip_info.ip));
4141
s_retry_num = 0;
4242
xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT);
4343
}

0 commit comments

Comments
 (0)