おはようございます。

上差しライブカメラのレンズも綺麗になっていました。

GWも4日目に入りました。右差し 5/1、5/2は有給休暇を取得しています。

で紹介したWiFi Routerですが、近況をお知らせ致します。
実は、ソースコードをビルドするときに必要となる各種ライブラリが更新されました。右差しオンラインで更新されてしまった。。。
それらのライブラリのAPIとRouterとのソースコード互換性が損なわれて、ビルドが通らなくなってしまいました。

右差しいちいちソースコードを修正するのは、とっても大変そうです。恐らく私と同じ境遇の方が居ると思い、ネットで検索すると

が見つかりました。
このソースコードを拝借して、Visual Stadio Code(Version 1.78.2) + PlatoformIO Ext.(v3.3.1)環境でビルドしてみるとラッキーにも、ビルドが通りました。

ㇹって感じです。

早速、ソースコード(esp32_nat_router.c)を弄って、APのステルスモード:ON、Ch. = 5を設定後に再ビルドして使っています。筋肉

    wifi_config_t ap_config = {

        .ap = {

            .authmode = WIFI_AUTH_WPA2_PSK,

            .ssid_hidden = 1,               //

            .channel = 5,                     //

            .max_connection = 10,

            .beacon_interval = 100,

            .pairwise_cipher = WIFI_CIPHER_TYPE_CCMP

        }

    };

それから、
## Access devices behind the router

If you want to access a device behind the esp32 NAT router? `PC -> local router -> esp32NAT -> server`

Lets say "server" is exposing a webserver on port 80 and you want to access that from your PC.  
For that you need to configure a portmap (e.g. by connecting via the arduino IDE uart monitor through USB)

```
portmap add TCP 8080 192.168.4.2 80
                                 ↑ port of the webserver
                            ↑ server's ip in esp32NAT network
                  ↑ exposed port in the local router's network
```
     
Assuming the esp32NAT's ip address in your `local router` is `192.168.0.57` you can acces the server by typing `192.168.0.57:8080` into your browser now.


## Interpreting the on board LED

If the ESP32 is connected to the upstream AP then the on board LED should be on, otherwise off.
If there are devices connected to the ESP32 then the on board LED will keep blinking as many times as the number of devices connected.

For example:

One device connected to the ESP32, and the ESP32 is connected to upstream: 

`*****.*****`

Two devices are connected to the ESP32, but the ESP32 is not connected to upstream: 

`....*.*....`
 

以上の機能は、今のところ動作しない様です。右差し ソースコードを追ってみましたが、オリジナル版と同様な実装はされているようです。
 

因みにESP-IDF v5.01の環境では、

となっています。

ということで、今回PlatoformIO環境で得られたバイナリーは、しっかりバックアップを取っておきます。(笑)
ではでは。

 

Special Thanks to

グッ
 

 追伸

は、ESP-IDF v4.4の環境でビルド出来ることが分かりました。グッ

ということは、Visual Studio CodeのPlatformIO Ext.でESP-IDF v4.4と互換性のあるバージョンでも同様にビルドが通ると思われます。

の記事を参考にさせて頂きました。

 

platoform.iniで
 

 

[env]

platform = espressif32@4.4

の様に指定したら、ビルド一発です。グッ