var wifi = require("Wifi"); wifi.scan((ap)=>print(ap));

Posted on
Page
of 2
Prev
/ 2
  • You need to compile the espruino firmware locally on your own PC. I did my compilation on:

    $ uname -a
    Linux kaki5 5.13.0-30-generic #33~20.04.1-Ubuntu SMP Mon Feb 7 14:25:10 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

    One this we need to change in user_main.c under Espruino/targets/esp8266
    $ diff user_main.c user_main.c-ORIG
    353,382d352
    < void ICACHE_FLASH_ATTR user_pre_init(void)
    < {
    < bool rc = false;
    < static const partition_item_t part_table[] =
    < {
    < {SYSTEM_PARTITION_RF_CAL,
    < 0x3fb000,
    < 0x1000},
    < {SYSTEM_PARTITION_PHY_DATA,
    < 0x3fc000,
    < 0x1000},
    < {SYSTEM_PARTITION_SYSTEM_PARAMETER,
    < 0x3fd000,
    < 0x3000},
    < };
    <
    < // This isn't an ideal approach but there's not much point moving on unless
    < // or until this has succeeded cos otherwise the SDK will just barf and
    < // refuse to call user_init()
    < while (!rc)
    < {
    < rc = system_partition_table_regist(part_table­,
    < sizeof(part_table)/sizeof(part_table[0])­,
    < 4);
    < }
    <
    < return;
    < }
    <
    <
    388d357
    < user_pre_init();

    The firmware would not compile without the user_pre_init(). Insert this block of code

    void ICACHE_FLASH_ATTR user_pre_init(void)
    {
    bool rc = false;
    static const partition_item_t part_table[] =
    {

    {SYSTEM_PARTITION_RF_CAL,
     0x3fb000,
     0x1000},
    {SYSTEM_PARTITION_PHY_DATA,
     0x3fc000,
     0x1000},
    {SYSTEM_PARTITION_SYSTEM_PARAMETER,
     0x3fd000,
     0x3000},
    

    };

    // This isn't an ideal approach but there's not much point moving on unless
    // or until this has succeeded cos otherwise the SDK will just barf and
    // refuse to call user_init()
    while (!rc)
    {

    rc = system_partition_table_regist(part_table­,
                                       sizeof(part_table)/sizeof(part_table[0])­,
                                       4);
    

    }

    return;
    }

    Above the void user_init() function. Insert user_pre_init() as the first statement in the user_init() function

    void user_init() {

      user_pre_init();
      system_timer_reinit(); // use microsecond os_timer_*
      ....
    

    I do not use the Espruino/scripts/provision.sh to build, but my own simple script:

    #!/usr/bin/sh
    echo "---------------------------------------­-------------------"
    echo "Building Espruino for ESP8266 4MB Flash"
    export ESP8266_SDK_ROOT=/home/sharil/MJ/ESP8266­_NONOS_SDK
    export PATH=/usr/local/sbin:/usr/local/bin:/usr­/sbin:/usr/bin:/sbin:pwd/xtensa-lx106-elf/bin/
    echo GCC is $(which xtensa-lx106-elf-gcc)
    rm espruinoesp8266
    make clean

    make V=1 RELEASE=1 BOARD=ESP8266_4MB

    make V=1 RELEASE=1 BOARD=ESP8266_ME
    echo "ESP8266 (4MB Flash) build done"
    echo "---------------------------------------­-------------------"

    Note that used ESP8266_ME board which is a copy of ESP8266_4MB.py with 'FILESYSTEM', 'FLASHFS' included in the libraries.

    Please give it a try.

  • Sorry for the markdown rendering of the listing.

  • @stumin Thanks fo sharing, make works. Let's mode this to a new conversation.

  • Good I'm glad. How the tests when?

  • 是不是设置功率参数问题
    是不是设置功率参数问题
    Is there a problem with setting power parameters

  • Ok, look's like you still think your board is not the issue.

    Please try this snippet and if it doesn't work you might be better with a different board.

    var Wifi = require('Wifi');
    var ssid = '<replace with your ssids name>';
    var password = '<replace with your password>';
      
    Wifi.stopAP();
    Wifi.setConfig({phy : '11n', powersave : 'none'});
    
     Wifi.connect(ssid, {password:password}, function(err) {
          if (err) {
            console.log('Wifi.connect(err):', err);
          } else {
           console.log('connected');
           Wifi.save();
          }
        });
    
    
  • People were reporting problems with WiFi on newer Wemos esp8266 V3 board. Boards with lower version (<3) seem to work fine. I have several of these boards and I've try on 3 of those. Sorry, no luck.

  • [ ]


    1 Attachment

    • 微信截图_20220307192425.png
  • 是它吗?
    Is that it?


    1 Attachment

    • 微信图片_20220307192643.jpg
  • were are you from?

  • but it in arduino is ok

  • Can the project be ported to Arduino platform for compilation?

  • I'm jumping in without context. Given that the ESP chips have Wi-Fi but it isn't available on some devices. Does this mean I can compile a version for the Bangle.js 2 w/Wi-Fi? There's still a lot of static friction in my coming up to speed. For now I want to just understand what's possible and, perhaps, what's feasible.

  • serial attached

    http://www.espruino.com/ESP8266

    or spi

    http://www.espruino.com/WIZnet

    I use nrf52 and a WIZ850io clone with custom build firmware

  • Bangle.js 2 is a smart watch. Wired connected WiFi device to it would be impractical. I would rather look at the possibility of using BLE to WiFi bridge.

  • Alas, the chip does not support Wi-Fi.

    I am curious as to why you consider it impractical on principle.

  • You can not easily access the UART/SPI pins without opening the watch from its casing. This means practically destroying your Bangle.js 2.

  • Oh -- I found Bangle.js 2 doesn't have WI-Fi so it's moot. I was thinking of other devices.

  • If the connection succeeds once, the subsequent connection fails, V3 is too

  • 34/5000
    As long as the rest press fails, only load bin to SEP8266 again

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

var wifi = require("Wifi"); wifi.scan((ap)=>print(ap));

Posted by Avatar for 影之刃 @影之刃

Actions