Skip to content

Commit

Permalink
rpn: do not link with Core wifi lib
Browse files Browse the repository at this point in the history
  • Loading branch information
mcspr committed Feb 9, 2022
1 parent 69b6f84 commit 3e9acdf
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions code/espurna/rpnrules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ void scheduleSleep(uint64_t duration, RFMode mode) {
}

void sleep(uint64_t duration, RFMode mode) {
if (WiFi.getMode() != WIFI_OFF) {
if (wifi_get_opmode() != NULL_MODE) {
wifiTurnOff();
scheduleSleep(duration, mode);
return;
Expand Down Expand Up @@ -1175,11 +1175,8 @@ namespace wifi {

void init(rpn_context& context) {
rpn_operator_set(context, "stations", 0, [](rpn_context& ctxt) -> rpn_error {
rpn_uint out = (WiFi.getMode() & WIFI_AP)
? static_cast<rpn_uint>(WiFi.softAPgetStationNum())
: 0u;

rpn_stack_push(ctxt, rpn_value(out));
rpn_stack_push(ctxt, rpn_value {
static_cast<rpn_uint>(wifiApStations()) });
return 0;
});

Expand All @@ -1190,11 +1187,11 @@ void init(rpn_context& context) {
});

rpn_operator_set(context, "rssi", 0, [](rpn_context& ctxt) -> rpn_error {
if (wifiConnected()) {
rpn_stack_push(ctxt, rpn_value(static_cast<rpn_int>(WiFi.RSSI())));
return 0;
}
return rpn_operator_error::CannotContinue;
const rpn_int rssi = wifiConnected()
? wifi_station_get_rssi()
: -127;
rpn_stack_push(ctxt, rpn_value { rssi });
return 0;
});
}

Expand Down

0 comments on commit 3e9acdf

Please sign in to comment.