Skip to content
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

Wifi status localip #9

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ifeq ($(FQBN),)
$(error "Must set variable FQBN in order to be able to compile Arduino sketches !")
else
# CAUTION : only use '=' when assigning values to vars, not '+='
arduino-cli.exe compile \
arduino-cli compile \
--clean \
--log \
--warnings all \
Expand All @@ -104,7 +104,7 @@ ifeq ($(FQBN),)
else
# compiler.c.extra_flags : switch to -std=c23 whenever XMCLib is conforming; currently neither c99 nor c11 work !
# CAUTION : only use '=' when assigning values to vars, not '+='
arduino-cli.exe compile \
arduino-cli compile \
--clean \
--log \
--warnings all \
Expand All @@ -127,7 +127,7 @@ endif
ifeq ($(FQBN),)
$(error "Must set variable FQBN in order to be able to flash Arduino sketches !")
else
arduino-cli.exe upload \
arduino-cli upload \
-p $(PORT) \
--fqbn $(FQBN) \
--verbose \
Expand All @@ -145,7 +145,7 @@ endif
ifeq ($(FQBN),)
$(error "Must set variable FQBN in order to be able to flash Arduino sketches !")
else
arduino-cli.exe monitor \
arduino-cli monitor \
-c baudrate=$(BAUD_RATE) \
-p $(PORT) \
--fqbn $(FQBN)
Expand Down
27 changes: 23 additions & 4 deletions src/corelibs/wifi/test_wifi_ap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,38 @@ static TEST_SETUP(wifi_ap) {
}

static TEST_TEAR_DOWN(wifi_ap) {
WiFi.end();
}

TEST(wifi_ap, begin_ap) {
TEST_IFX(wifi_ap, begin_ap) {
int result = WiFi.beginAP("arduino-wifi-ap", "wifi-ap-password", 1);
TEST_ASSERT_EQUAL_INT(WL_AP_CONNECTED, result);
}

/* Wait forever for now. */
while(true) {};
TEST_IFX(wifi_ap, is_status_connected) {
TEST_ASSERT_EQUAL_INT(WL_AP_CONNECTED, WiFi.status());
}

TEST_IFX(wifi_ap, check_local_ip) {
IPAddress ip = WiFi.localIP();
TEST_ASSERT_EQUAL_INT(192, ip[0]);
TEST_ASSERT_EQUAL_INT(168, ip[1]);
TEST_ASSERT_EQUAL_INT(0, ip[2]);
TEST_ASSERT_EQUAL_INT(1, ip[3]);
}

TEST_IFX(wifi_ap, wifi_end) {
WiFi.end();
}

TEST_GROUP_RUNNER(wifi_ap) {
RUN_TEST_CASE(wifi_ap, begin_ap);
RUN_TEST_CASE(wifi_ap, is_status_connected);
RUN_TEST_CASE(wifi_ap, check_local_ip);
/* Wait forever for now. */
/* This allows to check the sta
test manually. */
while(true) {};
RUN_TEST_CASE(wifi_ap, wifi_end);
}


22 changes: 20 additions & 2 deletions src/corelibs/wifi/test_wifi_sta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,37 @@ static TEST_SETUP(wifi_sta) {
}

static TEST_TEAR_DOWN(wifi_sta) {
WiFi.end();
}

TEST(wifi_sta, connect_to_ap) {
TEST_IFX(wifi_sta, connect_to_ap) {
/* This AP is created by the test_wifi_ap.
Currently the test tools does provide a way to and synch multitest.
It has only be validated manually. */
int result = WiFi.begin("arduino-wifi-ap", "wifi-ap-password");
TEST_ASSERT_EQUAL_INT(WL_CONNECTED, result);
}

TEST_IFX(wifi_sta, is_status_connected) {
TEST_ASSERT_EQUAL_INT(WL_CONNECTED, WiFi.status());
}

TEST_IFX(wifi_sta, check_local_ip) {
IPAddress ip = WiFi.localIP();
TEST_ASSERT_EQUAL_INT(192, ip[0]);
TEST_ASSERT_EQUAL_INT(168, ip[1]);
TEST_ASSERT_EQUAL_INT(0, ip[2]);
TEST_ASSERT_EQUAL_INT(2, ip[3]);
}

TEST_IFX(wifi_sta, wifi_end) {
WiFi.end();
}

TEST_GROUP_RUNNER(wifi_sta) {
RUN_TEST_CASE(wifi_sta, connect_to_ap);
RUN_TEST_CASE(wifi_sta, is_status_connected);
RUN_TEST_CASE(wifi_sta, check_local_ip);
RUN_TEST_CASE(wifi_sta, wifi_end);
}