Skip to content

Commit 0628e60

Browse files
4rynvAryanvovw
authored
Display ip address of the web tuning server on oled (#171)
* added code for displaying ip address of the web tuning server * made correct changes in the self-balancing * added .DS_Store to .gitignore * changes according to applied changes in the sra-board-components PR * updated sdkconfig.defaults to solve bloating of the build * removed .DS_Store --------- Co-authored-by: Aryan <aryanv@Aryans-MacBook-Air.local> Co-authored-by: atharva <62803658+vovw@users.noreply.github.com>
1 parent 6ea9c8a commit 0628e60

4 files changed

Lines changed: 20 additions & 4 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,6 @@ _deps
101101
!.vscode/launch.json
102102
!.vscode/extensions.json
103103
*.code-workspace
104+
105+
### macOS ###
106+
.DS_Store

6_line_following/main/line_following.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include "freertos/task.h"
44
#include "sra_board.h"
55
#include "tuning_http_server.h"
6+
#include "esp_netif.h"
7+
#include "lwip/ip4_addr.h"
68

79
#define MODE NORMAL_MODE
810
#define BLACK_MARGIN 4095
@@ -133,10 +135,15 @@ void line_follow_task(void* arg)
133135
//ESP_LOGI("debug","left_duty_cycle: %f :: right_duty_cycle : %f :: error : %f correction : %f \n",left_duty_cycle, right_duty_cycle, error, correction);
134136
ESP_LOGI("debug", "KP: %f :: KI: %f :: KD: %f", read_pid_const().kp, read_pid_const().ki, read_pid_const().kd);
135137
#ifdef CONFIG_ENABLE_OLED
136-
// Diplaying kp, ki, kd values on OLED
138+
// Displaying kp, ki, kd values on OLED
137139
if (read_pid_const().val_changed)
138140
{
139-
display_pid_values(read_pid_const().kp, read_pid_const().ki, read_pid_const().kd);
141+
esp_netif_ip_info_t ip_info;
142+
esp_netif_get_ip_info(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF"), &ip_info);
143+
144+
const char *ip_str_value = ip4addr_ntoa((const ip4_addr_t *)&ip_info.ip);
145+
display_pid_values(read_pid_const().kp, read_pid_const().ki, read_pid_const().kd, ip_str_value);
146+
140147
reset_val_changed_pid_const();
141148
}
142149
#endif

7_self_balancing/main/self_balancing.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include <math.h>
88

99
#include "tuning_websocket_server.h"
10+
#include "esp_netif.h"
11+
#include "lwip/ip4_addr.h"
1012

1113
//Limiting Variables
1214
#define MAX_PITCH_CORRECTION (90.0f)
@@ -167,8 +169,11 @@ void balance_task(void *arg)
167169
// Diplaying kp, ki, kd values on OLED
168170
if (read_pid_const().val_changed)
169171
{
170-
display_pid_values(read_pid_const().kp, read_pid_const().ki, read_pid_const().kd);
171-
reset_val_changed_pid_const();
172+
esp_netif_ip_info_t ip_info;
173+
esp_netif_get_ip_info(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF"), &ip_info);
174+
const char *ip_str_value = ip4addr_ntoa((const ip4_addr_t *)&ip_info.ip);
175+
display_pid_values(read_pid_const().kp, read_pid_const().ki, read_pid_const().kd, ip_str_value);
176+
reset_val_changed_pid_const();
172177
}
173178
#endif
174179
vTaskDelay(10 / portTICK_PERIOD_MS);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y
12
CONFIG_ENABLE_OLED=y

0 commit comments

Comments
 (0)