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

How to Download the Code? #11

Closed
Alaa-Aim opened this issue Dec 19, 2021 · 89 comments
Closed

How to Download the Code? #11

Alaa-Aim opened this issue Dec 19, 2021 · 89 comments

Comments

@Alaa-Aim
Copy link

Hi Sir
I'm still new on this field, may I know how to download the code to the ESP32? which tool to use for download? is it working on PZEM V3.0?

@vortigont
Copy link
Owner

Hi @Alaa-Aim, the project could be build with PlatformIO, you can find more detailed description at the BUILD page. You also need to upload an FS image to the ESP, there is a shell script for this if you run linux, for windows you might need to install bash for windows, check some online tutorials for this.
Yes, it works pretty fine with PZEM v3.0

@Alaa-Aim
Copy link
Author

Hi @vortigont , thanks for your prompt response, I'm using Windows, I'll install VS code and platformIO as Add-one, for the FS image, do you mean the SPIFF files ?

@vortigont
Copy link
Owner

vortigont commented Dec 20, 2021

yeah, only this project uses newer LittleFS instead of SPIFFS. Current Arduino ESP32 framework can't create such an images by default, so you need to download an mklittlefs.exe tool from this page and drop it to the project's folder where the platformio.ini is and you'll be able to do pio run -t uploadfs then.
Do not forget to populate ./data/ dir first by running resources/respack.sh script.

@Alaa-Aim
Copy link
Author

@vortigont thank you for your response, I tried ton build this using VSCode with no success, I always get error in the included libraries, I've tried to install the required libraries, libraries installed successfully but have the red error line under the libraries, any advice ? thank you in advanced

@vortigont
Copy link
Owner

@Alaa-Aim
you do not have to install any libs, platformio should do it during building. Might be something with your setup, maybe 'git' is missing in your system or 'python'? What is your OS - linux or windows? Can you show the error you have in the build terminal console?
I can build you the firmware binaries, not a problem, but it would be tricky to upload it intro ESP32 without properly working Platformio environment.

@Alaa-Aim
Copy link
Author

many thanks for your response, my OS is Windows, I've installed Arduino, VSCode then added PlatformIO IDE, but I still have the same errors, I installed fresh OS and install Arduino and VSCode only, still the same issue, terminal as below :
image

Processing espem (platform: espressif32; board: wemos_d1_mini32; framework: arduino) --------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via -v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/wemos_d1_mini32.html
PLATFORM: Espressif 32 (3.4.0) > WeMos D1 MINI ESP32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:

  • framework-arduinoespressif32 3.10006.210326 (1.0.6)
  • tool-esptoolpy 1.30100.210531 (3.1.0)
  • toolchain-xtensa32 2.50200.97 (5.2.0)
    LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Library Manager: Installing git+https://github.com/charno/FTPClientServer
    UserSideException: Please install Git client from https://git-scm.com/downloads:
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\builder\main.py", line 181:
    env.SConscript("$BUILD_SCRIPT")
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Script\SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
    File "C:\Users\ALAA.platformio\platforms\espressif32\builder\main.py", line 233:
    target_elf = env.BuildProgram()
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 62:
    env.ProcessProjectDeps()
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 141:
    project_lib_builder = env.ConfigureProjectLibBuilder()
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 1104:
    project.install_dependencies()
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 940:
    lm.install(spec)
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\package\manager_install.py", line 48:
    pkg = self._install(
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\package\manager\library.py", line 93:
    return super(LibraryPackageManager, self).install(
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\package\manager_install.py", line 97:
    pkg = self.install_from_url(spec.url, spec, silent=silent)
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\package\manager_install.py", line 141:
    vcs = VCSClientFactory.new(tmp_dir, url)
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\package\vcsclient.py", line 54:
    obj = getattr(sys.modules[name], "%sClient" % type
    .title())(
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\package\vcsclient.py", line 138:
    super(GitClient, self).init(*args, **kwargs)
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\package\vcsclient.py", line 72:
    self.check_client()
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\package\vcsclient.py", line 161:
    raise UserSideException(
    ================================================== [FAILED] Took 1.07 seconds ==================================================
    Environment Status Duration

espem FAILED 00:00:01.075
============================================ 1 failed, 0 succeeded in 00:00:01.075 ============================================
The terminal process "C:\Users\ALAA.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.`

@vortigont
Copy link
Owner

here is your issue
UserSideException: Please install Git client from https://git-scm.com/downloads:

@Alaa-Aim
Copy link
Author

Dear @vortigont , already installed git , this is what I got:

image
'Processing espem (platform: espressif32; board: wemos_d1_mini32; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/wemos_d1_mini32.html
PLATFORM: Espressif 32 (3.4.0) > WeMos D1 MINI ESP32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:

  • framework-arduinoespressif32 3.10006.210326 (1.0.6)
  • tool-esptoolpy 1.30100.210531 (3.1.0)
  • toolchain-xtensa32 2.50200.97 (5.2.0)
    LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 38 compatible libraries
    Scanning dependencies...
    Dependency Graph
    |-- 0.0.0+sha.f3521ff
    | |-- 1.0
    | |-- 1.0
    |-- 2.6.0+sha.cd4ea6d
    | |-- 6.18.5
    | |-- 0.9.0
    | | |-- 1.1.1
    | |-- 3.6.0
    | |-- 1.4.0+sha.c19a817
    | |-- 1.0
    | |-- 1.2
    | | |-- 1.0
    | | |-- 1.0
    | | | |-- 1.0
    | |-- 1.1.1
    | |-- 1.2.3+sha.fdd1b43
    | | |-- 1.1.1
    | | |-- 1.0
    | | |-- 1.0
    | | |-- 6.18.5
    | |-- 1.0
    | | |-- 1.0
    | |-- 1.0
    | |-- <LittleFS_esp32> 1.0.6+sha.f0817ca
    | | |-- 1.0
    | |-- 1.0
    |-- 0.0.4+sha.d8b2a48
    | |-- 1.4.0+sha.c19a817
    |-- 1.1.1
    |-- <LittleFS_esp32> 1.0.6+sha.f0817ca
    | |-- 1.0
    |-- 1.2.3+sha.fdd1b43
    | |-- 1.1.1
    | |-- 1.0
    | |-- 1.0
    | |-- 6.18.5
    fatal: not a git repository (or any of the parent directories): .git
    Traceback (most recent call last):
    File "D:\ESP\flags.py", line 6, in
    subprocess.check_output(["git", "describe", "--abbrev=4", "--always", "--tags", "--long"])
    File "C:\Users\ALAA.platformio\python3\lib\subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    File "C:\Users\ALAA.platformio\python3\lib\subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
    subprocess.CalledProcessError: Command '['git', 'describe', '--abbrev=4', '--always', '--tags', '--long']' returned non-zero exit status 128.
    OSError: 'python flags.py' exited 1:
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\builder\main.py", line 181:
    env.SConscript("$BUILD_SCRIPT")
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Script\SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
    File "C:\Users\ALAA.platformio\platforms\espressif32\builder\main.py", line 233:
    target_elf = env.BuildProgram()
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 62:
    env.ProcessProjectDeps()
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 159:
    projenv.ProcessFlags(env.get("SRC_BUILD_FLAGS"))
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 223:
    env.Append(**env.ParseFlagsExtended(flags))
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 186:
    for key, value in env.ParseFlags(str(raw)).items():
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Environment.py", line 815:
    do_parse(arg)
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Environment.py", line 667:
    arg = self.backtick(arg[1:])
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Environment.py", line 579:
    raise OSError("'%s' exited %d" % (command, status))
    ================================================== [FAILED] Took 2.23 seconds ==================================================
    Environment Status Duration

espem FAILED 00:00:02.226
============================================ 1 failed, 0 succeeded in 00:00:02.226 ============================================
The terminal process "C:\Users\ALAA.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.
'

@vortigont
Copy link
Owner

ugh...
subprocess.CalledProcessError: Command '['git', 'describe', '--abbrev=4', '--always', '--tags', '--long']' returned non-zero exit
looks like that's a Windows issue... pretty ugly OS :)
I'll fix that and let you know, need to find some windows hosts to test :))))

@vortigont
Copy link
Owner

Meanwhile you can workaround it,
open 'platformio.ini' file and replace this line !python flags.py with -DGIT_REV="git_xxx"
Mind the spaces indent!

@Alaa-Aim
Copy link
Author

@vortigont many thanks for your replied and patient, really appreciate it, wait to hear from you, bear with me, I'm still noob in this field and still learning.

@vortigont
Copy link
Owner

@Alaa-Aim you are wecome!
You may also face some issues with building FS image under windows. Actually never tested it, because it requires some unix tools to be available under windows, usually comes with git-bash installed.
Anyway, here is an FS image file for you attached. Just drop it under .pio/build/espem
spiffs.zip

@Alaa-Aim
Copy link
Author

@vortigont I did replaced '!python flags.py' with '-DGIT_REV="git_2.34.1"', still have error, thanks for the SPIFFS

image

'Processing espem (platform: espressif32; board: wemos_d1_mini32; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/wemos_d1_mini32.html
PLATFORM: Espressif 32 (3.4.0) > WeMos D1 MINI ESP32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:

  • framework-arduinoespressif32 3.10006.210326 (1.0.6)
  • tool-esptoolpy 1.30100.210531 (3.1.0)
  • toolchain-xtensa32 2.50200.97 (5.2.0)
    LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 38 compatible libraries
    Scanning dependencies...
    Dependency Graph
    |-- 0.0.0+sha.f3521ff
    | |-- 1.0
    | |-- 1.0
    |-- 2.6.0+sha.cd4ea6d
    | |-- 6.18.5
    | |-- 0.9.0
    | | |-- 1.1.1
    | |-- 3.6.0
    | |-- 1.4.0+sha.c19a817
    | |-- 1.0
    | |-- 1.2
    | | |-- 1.0
    | | |-- 1.0
    | | | |-- 1.0
    | |-- 1.1.1
    | |-- 1.2.3+sha.fdd1b43
    | | |-- 1.1.1
    | | |-- 1.0
    | | |-- 1.0
    | | |-- 6.18.5
    | |-- 1.0
    | | |-- 1.0
    | |-- 1.0
    | |-- <LittleFS_esp32> 1.0.6+sha.f0817ca
    | | |-- 1.0
    | |-- 1.0
    |-- 0.0.4+sha.d8b2a48
    | |-- 1.4.0+sha.c19a817
    |-- 1.1.1
    |-- <LittleFS_esp32> 1.0.6+sha.f0817ca
    | |-- 1.0
    |-- 1.2.3+sha.fdd1b43
    | |-- 1.1.1
    | |-- 1.0
    | |-- 1.0
    | |-- 6.18.5
    Building in release mode
    Replace MKSPIFFSTOOL with mklittlefs.exe
    Compiling .pio\build\espem\src\espem.cpp.o
    Compiling .pio\build\espem\src\interface.cpp.o
    Compiling .pio\build\espem\src\main.cpp.o
    Compiling .pio\build\espem\lib0ad\FS\vfs_api.cpp.o
    :0:14: error: too many decimal points in number
    espem\main.cpp:106:5: note: in expansion of macro 'GIT_REV'
    GIT_REV,
    ^
    Archiving .pio\build\espem\lib0ad\libFS.a
    espem\main.cpp: In function 'void wver(AsyncWebServerRequest*)':
    :0:9: error: 'git_2' was not declared in this scope
    espem\main.cpp:106:5: note: in expansion of macro 'GIT_REV'
    GIT_REV,
    ^
    Compiling .pio\build\espem\lib5f0\WiFi\ETH.cpp.o
    *** [.pio\build\espem\src\main.cpp.o] Error 1
    ================================================== [FAILED] Took 7.47 seconds ==================================================
    Environment Status Duration

espem FAILED 00:00:07.471
============================================ 1 failed, 0 succeeded in 00:00:07.471 ============================================
The terminal process "C:\Users\ALAA.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.
'

@vortigont
Copy link
Owner

OK, here is the real revision string -DGIT_REV='"v2.0.1-10-gfba6"', try this one

@vortigont
Copy link
Owner

or maybe omit single quotes, just -DGIT_REV="v2.0.1-10-gfba6"
not sure how windoze likes it :)

@Alaa-Aim
Copy link
Author

or maybe omit single quotes, just -DGIT_REV="v2.0.1-10-gfba6" not sure how windose likes it :)

Windows like it with two quotes, compile is successful but when connect to it and navigate to 192.168.4.1 it shows "not found", I remembered to upload FS, when I ran platformio run -t uploadfs , this is what i got:

PS D:\ESP> platformio run -t uploadfs
Can not remove temporary directory D:\ESP\.pio\build. Please remove it manually to avoid build issues
Processing espem (platform: espressif32; board: wemos_d1_mini32; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/wemos_d1_mini32.html
PLATFORM: Espressif 32 (3.4.0) > WeMos D1 MINI ESP32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:

  • framework-arduinoespressif32 3.10006.210326 (1.0.6)
  • tool-esptoolpy 1.30100.210531 (3.1.0)
  • tool-mkspiffs 2.230.0 (2.30)
  • toolchain-xtensa32 2.50200.97 (5.2.0)
    LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 38 compatible libraries
    Scanning dependencies...
    Dependency Graph
    |-- 0.0.0+sha.f3521ff
    | |-- 1.0
    | |-- 1.0
    |-- 2.6.0+sha.cd4ea6d
    | |-- 6.18.5
    | |-- 0.9.0
    | | |-- 1.1.1
    | |-- 3.6.0
    | |-- 1.4.0+sha.c19a817
    | |-- 1.0
    | |-- 1.2
    | | |-- 1.0
    | | |-- 1.0
    | | | |-- 1.0
    | |-- 1.1.1
    | |-- 1.2.3+sha.fdd1b43
    | | |-- 1.1.1
    | | |-- 1.0
    | | |-- 1.0
    | | |-- 6.18.5
    | |-- 1.0
    | | |-- 1.0
    | |-- 1.0
    | |-- <LittleFS_esp32> 1.0.6+sha.f0817ca
    | | |-- 1.0
    | |-- 1.0
    |-- 0.0.4+sha.d8b2a48
    | |-- 1.4.0+sha.c19a817
    |-- 1.1.1
    |-- <LittleFS_esp32> 1.0.6+sha.f0817ca
    | |-- 1.0
    |-- 1.2.3+sha.fdd1b43
    | |-- 1.1.1
    | |-- 1.0
    | |-- 1.0
    | |-- 6.18.5
    Building in release mode
    Replace MKSPIFFSTOOL with mklittlefs.exe
    Building SPIFFS image from 'data' directory to .pio\build\espem\spiffs.bin
    '"./mklittlefs.exe"' is not recognized as an internal or external command,
    operable program or batch file.
    *** [.pio\build\espem\spiffs.bin] Error 1
    ================================================== [FAILED] Took 1.83 seconds ==================================================
    Environment Status Duration

espem FAILED 00:00:01.831
============================================ 1 failed, 0 succeeded in 00:00:01.831 ============================================

@Alaa-Aim
Copy link
Author

PS D:\ESP> platformio run -t upload Can not remove temporary directory D:\ESP.pio\build. Please remove it manually to avoid build issues Processing espem (platform: espressif32; board: wemos_d1_mini32; framework: arduino) --------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via -v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/wemos_d1_mini32.html
PLATFORM: Espressif 32 (3.4.0) > WeMos D1 MINI ESP32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:

  • framework-arduinoespressif32 3.10006.210326 (1.0.6)
  • tool-esptoolpy 1.30100.210531 (3.1.0)
  • tool-mkspiffs 2.230.0 (2.30)
  • toolchain-xtensa32 2.50200.97 (5.2.0)
    LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 38 compatible libraries
    Scanning dependencies...
    Dependency Graph
    |-- 0.0.0+sha.f3521ff
    | |-- 1.0
    | |-- 1.0
    |-- 2.6.0+sha.cd4ea6d
    | |-- 6.18.5
    | |-- 0.9.0
    | | |-- 1.1.1
    | |-- 3.6.0
    | |-- 1.4.0+sha.c19a817
    | |-- 1.0
    | |-- 1.2
    | | |-- 1.0
    | | |-- 1.0
    | | | |-- 1.0
    | |-- 1.1.1
    | |-- 1.2.3+sha.fdd1b43
    | | |-- 1.1.1
    | | |-- 1.0
    | | |-- 1.0
    | | |-- 6.18.5
    | |-- 1.0
    | | |-- 1.0
    | |-- 1.0
    | |-- <LittleFS_esp32> 1.0.6+sha.f0817ca
    | | |-- 1.0
    | |-- 1.0
    |-- 0.0.4+sha.d8b2a48
    | |-- 1.4.0+sha.c19a817
    |-- 1.1.1
    |-- <LittleFS_esp32> 1.0.6+sha.f0817ca
    | |-- 1.0
    |-- 1.2.3+sha.fdd1b43
    | |-- 1.1.1
    | |-- 1.0
    | |-- 1.0
    | |-- 6.18.5
    Building in release mode
    Replace MKSPIFFSTOOL with mklittlefs.exe
    Retrieving maximum program size .pio\build\espem\firmware.elf
    Checking size .pio\build\espem\firmware.elf
    Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
    RAM: [= ] 12.9% (used 42200 bytes from 327680 bytes)
    Flash: [======== ] 78.8% (used 1033181 bytes from 1310720 bytes)
    Configuring upload protocol...
    AVAILABLE: esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
    CURRENT: upload_protocol = esptool
    Looking for upload port...
    Auto-detected: COM3
    Uploading .pio\build\espem\firmware.bin
    esptool.py v3.1
    Serial port COM3
    Connecting........_
    Chip is ESP32-D0WDQ6 (revision 1)
    Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
    Crystal is 40MHz
    MAC: 3c:61:05:2e:a6:20
    Uploading stub...
    Running stub...
    Stub running...
    Changing baud rate to 460800
    Changed.
    Configuring flash size...
    Auto-detected Flash size: 4MB
    Flash will be erased from 0x00001000 to 0x00005fff...
    Flash will be erased from 0x00008000 to 0x00008fff...
    Flash will be erased from 0x0000e000 to 0x0000ffff...
    Flash will be erased from 0x00010000 to 0x0010cfff...
    Compressed 17104 bytes to 11191...
    Writing at 0x00001000... (100 %)
    Wrote 17104 bytes (11191 compressed) at 0x00001000 in 0.6 seconds (effective 231.1 kbit/s)...
    Hash of data verified.
    Compressed 3072 bytes to 128...
    Writing at 0x00008000... (100 %)
    Wrote 3072 bytes (128 compressed) at 0x00008000 in 0.1 seconds (effective 306.5 kbit/s)...
    Hash of data verified.
    Compressed 8192 bytes to 47...
    Writing at 0x0000e000... (100 %)
    Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 500.4 kbit/s)...
    Hash of data verified.
    Compressed 1033296 bytes to 589295...
    Writing at 0x00010000... (2 %)
    Writing at 0x0001b479... (5 %)
    Writing at 0x00029ca8... (8 %)
    Writing at 0x000328cf... (11 %)
    Writing at 0x00049785... (13 %)
    Writing at 0x00052ea1... (16 %)
    Writing at 0x00058fa8... (19 %)
    Writing at 0x0005f24f... (22 %)
    Writing at 0x000650c5... (25 %)
    Writing at 0x0006a23f... (27 %)
    Writing at 0x000711dd... (30 %)
    Writing at 0x00076f20... (33 %)
    Writing at 0x0007e3e9... (36 %)
    Writing at 0x0008836d... (38 %)
    Writing at 0x0008dd85... (41 %)
    Writing at 0x00093d28... (44 %)
    Writing at 0x000996c8... (47 %)
    Writing at 0x0009f7ee... (50 %)
    Writing at 0x000a5580... (52 %)
    Writing at 0x000ab3cc... (55 %)
    Writing at 0x000b16ab... (58 %)
    Writing at 0x000b7a94... (61 %)
    Writing at 0x000bd84c... (63 %)
    Writing at 0x000c3a0d... (66 %)
    Writing at 0x000c8b1c... (69 %)
    Writing at 0x000cdf48... (72 %)
    Writing at 0x000d33c0... (75 %)
    Writing at 0x000d899d... (77 %)
    Writing at 0x000ddd92... (80 %)
    Writing at 0x000e3443... (83 %)
    Writing at 0x000e8d88... (86 %)
    Writing at 0x000ef06d... (88 %)
    Writing at 0x000f4306... (91 %)
    Writing at 0x000fa717... (94 %)
    Writing at 0x001008b5... (97 %)
    Writing at 0x00106529... (100 %)
    Wrote 1033296 bytes (589295 compressed) at 0x00010000 in 14.8 seconds (effective 557.4 kbit/s)...

Leaving...
Hard resetting via RTS pin...
================================================= [SUCCESS] Took 27.99 seconds =================================================
Environment Status Duration


espem SUCCESS 00:00:27.991
================================================= 1 succeeded in 00:00:27.991 ================================================= `

@vortigont
Copy link
Owner

vortigont commented Dec 21, 2021

Nice! :)))
Check BUILD page, you need mklittlefs,exe binary to make FS iamges.

l but when connect to it and navigate to 192.168.4.1 it shows "not found"

you can also navigate to http://192.168.4.1/update and upload fs image I gave you from there

@Alaa-Aim
Copy link
Author

Nice! :))) Check BUILD page, you need mklittlefs,exe binary to make FS iamges.

l but when connect to it and navigate to 192.168.4.1 it shows "not found"

you can also navigate to http://192.168.4.1/update and upload fs image I gave you from there

I navaigate to 192.168.4.1/update, and uploaded the SPIFFS you gave me, the user interface worked but I can't change the name of AP and I can't connect to any WIFI network, any easy way for me to compile my own SPIFFS? really appreciate you response and replies.

@vortigont
Copy link
Owner

No need, you can do all from WebUI.
Internal AP name is hostname actually, can change under the 'device name' section.
WiFI connection is set under WiFi Client section, need to fill both SSID and password, there is no scanning for available AP's around. Once connected, esp will shutdown internal AP and you can access it via http://hostname/ in your network.

@Alaa-Aim
Copy link
Author

Actually I did all you mentioned, but when I enter the SSID & Password (entered manually as no scanning functionality) , ESP rest but nothing changed, still in AP mode and I can't change the host name nor connect to the WiFi , all above things I did it from webUI , but no success

@Alaa-Aim
Copy link
Author

image

@vortigont
Copy link
Owner

Ugh... not sure. Pls, try to build your own FS image as described in DOCS. Or you can try to clear config from "System setup" page.
Anyway you can try to connect your PZEM device right away and check it :)))
Going offline for today, will be back tomorrow.
Cheers!

@Alaa-Aim
Copy link
Author

device right away and check it :)))

I managed to make my FS
alaa85@DESKTOP-KSFF4NQ:/mnt/d/ESP/resources$ ./respack.sh Preparing resources for ESPEM FS image into ../data/ dir EmbUI resources requires updating Refreshing EmbUI css files/pics... ./respack.sh: 112: unzip: not found refreshing embui js files... alaa85@DESKTOP-KSFF4NQ:/mnt/d/ESP/resources$

this the files I had ,
image

still have the same error when I run platformio run -t uploadfs

"PS D:\ESP> platformio run -t uploadfs
Can not remove temporary directory D:\ESP\.pio\build. Please remove it manually to avoid build issues
Processing espem (platform: espressif32; board: wemos_d1_mini32; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/wemos_d1_mini32.html
PLATFORM: Espressif 32 (3.4.0) > WeMos D1 MINI ESP32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:

  • framework-arduinoespressif32 3.10006.210326 (1.0.6)
  • tool-esptoolpy 1.30100.210531 (3.1.0)
  • tool-mkspiffs 2.230.0 (2.30)
  • toolchain-xtensa32 2.50200.97 (5.2.0)
    LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 38 compatible libraries
    Scanning dependencies...
    Dependency Graph
    |-- 0.0.0+sha.f3521ff
    | |-- 1.0
    | |-- 1.0
    |-- 2.6.0+sha.cd4ea6d
    | |-- 6.18.5
    | |-- 0.9.0
    | | |-- 1.1.1
    | |-- 3.6.0
    | |-- 1.4.0+sha.c19a817
    | |-- 1.0
    | |-- 1.2
    | | |-- 1.0
    | | |-- 1.0
    | | | |-- 1.0
    | |-- 1.1.1
    | |-- 1.2.3+sha.fdd1b43
    | | |-- 1.1.1
    | | |-- 1.0
    | | |-- 1.0
    | | |-- 6.18.5
    | |-- 1.0
    | | |-- 1.0
    | |-- 1.0
    | |-- <LittleFS_esp32> 1.0.6+sha.f0817ca
    | | |-- 1.0
    | |-- 1.0
    |-- 0.0.4+sha.d8b2a48
    | |-- 1.4.0+sha.c19a817
    |-- 1.1.1
    |-- <LittleFS_esp32> 1.0.6+sha.f0817ca
    | |-- 1.0
    |-- 1.2.3+sha.fdd1b43
    | |-- 1.1.1
    | |-- 1.0
    | |-- 1.0
    | |-- 6.18.5
    Building in release mode
    Replace MKSPIFFSTOOL with mklittlefs.exe
    Building SPIFFS image from 'data' directory to .pio\build\espem\spiffs.bin
    '"./mklittlefs.exe"' is not recognized as an internal or external command,
    operable program or batch file.
    *** [.pio\build\espem\spiffs.bin] Error 1
    =========================================================== [FAILED] Took 1.88 seconds ===========================================================
    Environment Status Duration

espem FAILED 00:00:01.878
===================================================== 1 failed, 0 succeeded in 00:00:01.878 ====================================================="

@Alaa-Aim
Copy link
Author

Alaa-Aim commented Dec 21, 2021

@vortigont I managed to upload the SPIFFS I made, the languge become Russian (I guess) and I still have the same issue, can't change the device name, can't connect any WiFi even though I've tried many WiFis with no luck

image

@vortigont
Copy link
Owner

@Alaa-Aim OK, I was able to run this under windoze :)
I was even able to run without -DGIT_REV hack. I use windows 7, not sure if Win10 has some tricks, heard from other ppl that it's better to install python via Microsoft store or whatever it is called... nevermind. Actually you can just simply remove this line from platformio.ini, should be fine.
I've made some small fixes in repo, you need to redownload it from scratch, rebuild firmware and upload it into MCU,. Hope this will fix WiFi issue, even might not need to rebuild FS image. Just checked with a brand new esp32 board - it works pretty fine :)

What I did is installed git for windows with that feature enabled
image

than I was able build fw and run respack.sh script right from the VSCode terminal
image

I managed to make my FS ./respack.sh: 112: unzip: not found refreshing embui js files... alaa85@DESKTOP-KSFF4NQ:/mnt/d/ESP/resources$

this the files I had ,

That is not right! You miss unzip, so you actually have nothing. the directory with data is not resources, it's just sources. The real data for LittleFS goes into ./data dir. You should have there at least index.html.gz and css/js dirs.

  • Building SPIFFS image from 'data' directory to .pio\build\espem\spiffs.bin
    '"./mklittlefs.exe"' is not recognized as an internal or external command,

you are still missing mklittlefs.exe. AGAIN, pls read BUILD.md and download binary mklittlefs.exe for windows from specified REPO and place it into the repo's dir.

the languge become Russian (I guess)

you can change it back to English from "settings" page - top drop down list.

@Alaa-Aim
Copy link
Author

@vortigont , thanks for your effort and response, I downloaded the new respo, compiling was not success with the included platformIO.ini, i had to use the one we made yesterday, and compiling was successful, FS build was successful to after I placed the mklittlefs.exe in resources folder and I got index.htmland css/js dirs.
alaa85@DESKTOP-KSFF4NQ:/mnt/d/ESP/resources$ ./respack.sh Preparing resources for ESPEM FS image into ../data/ dir EmbUI is up to date refreshing embui js files... alaa85@DESKTOP-KSFF4NQ:/mnt/d/ESP/resources$
the I used the two commands to upload the code and the FS
platformio run -t upload
platformio run -t uploadfs

everything was successful, but when I connect to the ESP for configuration, the image below is what I got, I used brand new MCU and I Still have this issue

image

@vortigont
Copy link
Owner

everything was successful, but when I connect to the ESP for configuration, the image below is what I got

this is still wrong, you are missing css/js files in the ./data/ dir, this means respack.sh script failed to download new files.
And firmware source files are wrong - EmbUI version must be 2.6.1 with new sources. Try to delete project folder completely and download again from GitHub

@Alaa-Aim
Copy link
Author

@vortigont I removed the whole folder and downloaded a new one, the FS is made with no errors, below screen shots for the files i had,
image
image
image
image

when i use the provided .ini file, I get error when compiling as shown below :
"Processing espem (platform: espressif32; board: wemos_d1_mini32; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/wemos_d1_mini32.html
PLATFORM: Espressif 32 (3.4.0) > WeMos D1 MINI ESP32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:

  • framework-arduinoespressif32 3.10006.210326 (1.0.6)
  • tool-esptoolpy 1.30100.210531 (3.1.0)
  • toolchain-xtensa32 2.50200.97 (5.2.0)
    LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 38 compatible libraries
    Scanning dependencies...
    Dependency Graph
    |-- 0.0.0+sha.f3521ff
    | |-- 1.0
    | |-- 1.0
    |-- 2.6.0+sha.cb88d7f
    | |-- 6.18.5
    | |-- 0.9.0
    | | |-- 1.1.1
    | |-- 3.6.0
    | |-- 1.4.0+sha.c19a817
    | |-- 1.0
    | |-- 1.2
    | | |-- 1.0
    | | |-- 1.0
    | | | |-- 1.0
    | |-- 1.1.1
    | |-- 1.2.3+sha.fdd1b43
    | | |-- 1.1.1
    | | |-- 1.0
    | | |-- 1.0
    | | |-- 6.18.5
    | |-- 1.0
    | | |-- 1.0
    | |-- 1.0
    | |-- <LittleFS_esp32> 1.0.6+sha.f0817ca
    | | |-- 1.0
    | |-- 1.0
    |-- 0.0.4+sha.d8b2a48
    | |-- 1.4.0+sha.c19a817
    |-- 1.1.1
    |-- <LittleFS_esp32> 1.0.6+sha.f0817ca
    | |-- 1.0
    |-- 1.2.3+sha.fdd1b43
    | |-- 1.1.1
    | |-- 1.0
    | |-- 1.0
    | |-- 6.18.5
    fatal: not a git repository (or any of the parent directories): .git
    Traceback (most recent call last):
    File "D:\ESP32\flags.py", line 6, in
    subprocess.check_output(["git", "describe", "--abbrev=4", "--always", "--tags", "--long"])
    File "C:\Users\ALAA.platformio\python3\lib\subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    File "C:\Users\ALAA.platformio\python3\lib\subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
    subprocess.CalledProcessError: Command '['git', 'describe', '--abbrev=4', '--always', '--tags', '--long']' returned non-zero exit status 128.
    OSError: 'python flags.py' exited 1:
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\builder\main.py", line 181:
    env.SConscript("$BUILD_SCRIPT")
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Script\SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
    File "C:\Users\ALAA.platformio\platforms\espressif32\builder\main.py", line 233:
    target_elf = env.BuildProgram()
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 62:
    env.ProcessProjectDeps()
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 159:
    projenv.ProcessFlags(env.get("SRC_BUILD_FLAGS"))
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 223:
    env.Append(**env.ParseFlagsExtended(flags))
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
    File "C:\Users\ALAA.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 186:
    for key, value in env.ParseFlags(str(raw)).items():
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Environment.py", line 815:
    do_parse(arg)
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Environment.py", line 667:
    arg = self.backtick(arg[1:])
    File "C:\Users\ALAA.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Environment.py", line 579:
    raise OSError("'%s' exited %d" % (command, status))
    ================================================== [FAILED] Took 2.08 seconds ==================================================
    Environment Status Duration

espem FAILED 00:00:02.083
============================================ 1 failed, 0 succeeded in 00:00:02.083 ============================================
The terminal process "C:\Users\ALAA.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1."

and when I use the file we modified yesterday it compiles with no errors.

and still get the same page as last comment.

please advise, thanks for your efforts and response

@vortigont
Copy link
Owner

vortigont commented Jan 13, 2022

да, проблему с коннектом воспроизвел. Оч странно причем, на часах с этим же фреймворком все работает. Буду разбираться.

И mqtt походу тоже не але...

mqtt у меня в прошивке не реализован, как-то нужды не было. Настройки в вебюи это заготовка из фреймворка, но она там по сути пустая. Весь функционал надо самому писать. Если будет желание заняться тестированием и разработкой схемы в помощь, могу заняться этим чуть позже. В любом случае придется рано или поздно :)

P.S. а для пзема всяко лучше на есп32 переходить, весь дальнейший функционал буду расширять только на новой библиотеке.

@Aleks130699
Copy link

есп32 уже заказал, буду ждать, а если у вас нет mqtt то как забираете данные куда то дальше? или так только в вебуи смотрите?

@vortigont
Copy link
Owner

vortigont commented Jan 13, 2022

Повозился я с этой странной проблемой - контроллер тупо перегружается при попытке подключения в WiFi по вочдогу. Но зато проблема не наблюдается на другой платке, все абсолютно нормально. Т.е. код один и тот же, но разные платы ведут себя по-разному :) Причем на этой же глюкавой плате другой схожий проект работает - все в лучших традициях 8266.
Я попутно исправил несколько мелких багов, собрал 2 прошивки - дебаг и обычную (дебаг работает). Попробуйте, если будет вести себя так же, попробуйте другую плату если есть.
При наличии свободного времени может покопаюсь еще, но не общаю. Сейчас больше занят проектами под есп32.

(не то выложил)

@vortigont
Copy link
Owner

а если у вас нет mqtt то как забираете данные куда то дальше?

Я забираю их с контрллера скриптом и кладу в sqlite базу.
http://espem/getpmdata - текущие данные в plain-text
http://espem/getdata - текущие данные в json
http://espem/samples.json - вся выборка из буфера в json (по ней строится график в WebUI)

@vortigont
Copy link
Owner

актуальная сборка
espem_fw.zip

@vortigont vortigont pinned this issue Jan 18, 2022
@Aleks130699
Copy link

Добрый день, пришла esp32, код свежий залил, но чет точка доступа не появляется

@vortigont
Copy link
Owner

добрый. Ну посмотриете в вывод консоли, на есп32 это не сложно, там 0й сериал порт свободен. вы дебаг версию собрали?

@Aleks130699
Copy link

Собирал и дебаг версию, в консоле чет не чего полезного не было

@vortigont
Copy link
Owner

ну без лога я не знаю чем вам помочь.

там должно быть что-то вроде этого

UI WiFi: start in STA mode
UI WiFi: STA reconecting...

и т.д., дале обработка событий от вайфай.

@Aleks130699
Copy link

Этого не чего нет, как будто не инициализируется загрузка

@Aleks130699
Copy link

Вот после загрузки так и все
image

@Aleks130699
Copy link

хм....а на вторую esp залил, чет пошло вроде

@Aleks130699
Copy link

Aleks130699 commented Jan 28, 2022

В общем с другой заработало, но настройки wifi не сохраняются, и другие настройки тоже

@vortigont
Copy link
Owner

vortigont commented Jan 28, 2022

Вот после загрузки так и все image

хоже она входит в режим прошивки сразу при загрузке.

В общем с другой заработало, но настройки wifi не сохраняются, и другие настройки тоже

так вайфай подключается или нет? Настроки wifi сохраняются при успешном подключении к точке доступа, в противном случае сохранять нечего. Покажите лог.

@Aleks130699
Copy link

Aleks130699 commented Jan 28, 2022

После нажатия кнопки подключиться
image
image

@vortigont
Copy link
Owner

хм... контроллер падает при попытке распечатать какую-то путоту...
вы в поля подключения вифи, надеюсь, креды и имя точки вводите? введите левую точку доступа и левый пароль и покажите лог. Можно просто текст скопипастить, без скриншота :)

@Aleks130699
Copy link

Да конечно в поле доступа
Вот левые данные точки
`UI: section end:'root1165286902' [#0] MEM: 218716
UI: section begin:'root1165315260' [#0] 915 free
UI: Frame add obj 74 b, mem:109/1024...OK idx:0 MEM: 216268
UI: Frame add obj 67 b, mem:193/1024...OK idx:1 MEM: 216268
UI: Frame add obj 70 b, mem:262/1024...OK idx:2 MEM: 216268
UI: json_frame_flush
UI: section end:'root1165315260' [#0] MEM: 216292
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x400014fd PS : 0x00060230 A0 : 0x800fe49c A1 : 0x3ffb1a50
A2 : 0x00000000 A3 : 0xfffffffc A4 : 0x000000ff A5 : 0x0000ff00
A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x00000000 A9 : 0x00000009
A10 : 0x3ffb1e9f A11 : 0x3ffd8e4c A12 : 0x3ffb1ea8 A13 : 0x3ffc1c20
A14 : 0x00000000 A15 : 0x3ffb0060 SAR : 0x0000000a EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xffffffff

ELF file SHA256: 0000000000000000

Backtrace: 0x400014fd:0x3ffb1a50 0x400fe499:0x3ffb1a60 0x40105a12:0x3ffb1d70 0x40105a4e:0x3ffb1e00 0x400f7896:0x3ffb1e40 0x400f5feb:0x3ffb1ee0 0x400f4553:0x3ffb1f30 0x400f46e0:0x3ffb1f50 0x400e97d6:0x3ffb1f70 0x400d9122:0x3ffb1f90 0x400f9e4d:0x3ffb1fb0 0x4008a72a:0x3ffb1fd0
#0 0x400014fd:0x3ffb1a50 in ?? ??:0
#1 0x400fe499:0x3ffb1a60 in _vfiprintf_r at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdio/../../../.././newlib/libc/stdio/vfprintf.c:1173 (discriminator 30) #2 0x40105a12:0x3ffb1d70 in _svfiprintf_r at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdio/../../../.././newlib/libc/stdio/vfprintf.c:1192 (discriminator 30)
#3 0x40105a4e:0x3ffb1e00 in _svfiprintf_r at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdio/../../../.././newlib/libc/stdio/vfprintf.c:1199 (discriminator 6) #4 0x400f7896:0x3ffb1e40 in uartRead at C:\Users\Ravko.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-uart.c:519
#5 0x400f5feb:0x3ffb1ee0 in Print::write(char const*) at C:\Users\Ravko.platformio\packages\framework-arduinoespressif32\cores\esp32/Print.cpp:90
#6 0x400f4553:0x3ffb1f30 in ArduinoJson6191_F1::TextFormatter<ArduinoJson6191_F1::DummyWriter>::writeDecimals(unsigned int, signed char) at .pio\libdeps\espem\EmbUI\EmbUI/ui.h:43
(inlined by) void ArduinoJson6191_F1::TextFormatter<ArduinoJson6191_F1::DummyWriter>::writeFloat(double) at .pio\libdeps\espem\ArduinoJson\src/ArduinoJson/Json/TextFormatter.hpp:90
#7 0x400f46e0:0x3ffb1f50 in ArduinoJson6191_F1::enable_if<ArduinoJson6191_F1::is_signed::value, void>::type ArduinoJson6191_F1::TextFormatter<ArduinoJson6191_F1::DummyWriter>::writeInteger(long long) at .pio\libdeps\espem\EmbUI\EmbUI/ui.h:43
(inlined by) ArduinoJson6191_F1::JsonSerializer<ArduinoJson6191_F1::DummyWriter>::visitSignedInteger(long long) at .pio\libdeps\espem\ArduinoJson\src/ArduinoJson/Json/JsonSerializer.hpp:83
(inlined by) ArduinoJson6191_F1::JsonSerializer<ArduinoJson6191_F1::DummyWriter>::result_type ArduinoJson6191_F1::VariantData::accept<ArduinoJson6191_F1::JsonSerializer<ArduinoJson6191_F1::DummyWriter> >(ArduinoJson6191_F1::JsonSerializer<ArduinoJson6191_F1::DummyWriter>&) const at .pio\libdeps\espem\ArduinoJson\src/ArduinoJson/Variant/VariantData.hpp:63
#8 0x400e97d6:0x3ffb1f70 in EmbUI::var_remove(String const&) at .pio\libdeps\espem\ArduinoJson\src/ArduinoJson/Variant/VariantCompare.hpp:195
#9 0x400d9122:0x3ffb1f90 in FTPServer::FTPServer(fs::FS&) at .pio\libdeps\espem\FTP/FTPServer.cpp:44
#10 0x400f9e4d:0x3ffb1fb0 in md5_vector at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/wpa_supplicant/src/crypto/md5-internal.c:46
#11 0x4008a72a:0x3ffb1fd0 in vPortCPUAcquireMutexIntsDisabledInternal at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/portmux_impl.inc.h:107
(inlined by) vPortCPUAcquireMutexIntsDisabled at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/portmux_impl.h:98
(inlined by) uxPortCompareSetExtram at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:449

Rebooting...
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10124
load:0x40080400,len:5828
entry 0x400806a8
Starting EspEM...
UI: Config file load OK!
UI: Creating system vars
UI: Creating application vars
UI REGISTER: b_espem
UI REGISTER: b_emset
UI: Creating webui vars
UI REGISTER: settings
UI REGISTER: sh_sec
UI REGISTER: shname
UI REGISTER: set_wifi
UI REGISTER: set_wifiAP
UI REGISTER: set_mqtt
UI REGISTER: set_time
UI REGISTER: lang
UI REGISTER: reboot
UI REGISTER: time
UI REGISTER: s_cfgcl
UI REGISTER: a_setem
UI REGISTER: a_uart
UI REGISTER: dctl*
UI READ KEY: 'm_pref' VAL: '3A2618'
UI READ KEY: 'm_host' VAL: ''
UI READ KEY: 'm_port' VAL: ''
UI READ KEY: 'm_user' VAL: ''
UI READ KEY: 'm_pass' VAL: ''
UI: MQTT host is empty - disabled!
UI CONFIG: {"m_host":"","m_port":"","m_user":"","m_pass":"","m_pref":"3A2618","m_tupd":"30","dctlupdrt":2,"ems_prd":1,"emplsz":300,"uart":1,"rx":-1,"tx":-1}UI READ KEY: 'TZSET' VAL: ''
UI WiFi: start in STA mode
[E][WiFiSTA.cpp:221] begin(): connect failed!
generate autohostname: EmbUI-3A2618
UI WiFi: STA reconecting...
espem.begin: port: 1, rx_pin: -1, tx_pin:-1
Autopolling enabled
SRAM: heap 349036, free 233308
SPI-RAM: heap 0, free 0
UI WiFi: set AP params to SSID:EmbUI-3A2618, pwd:
UI mDNS: responder started: EmbUI-3A2618.local
UI WiFi: Switch to AP/STA mode
`

@vortigont
Copy link
Owner

Что-то у меня не воспроизводится никак...
попробуйте не дебаг версию. Если он падает на выводе дебаг сообщения, то без дебага должен прицепиться...
У вас он даже не успевает вывести креды с которыми долежн подключаться. Ну и смотрите просто в консоль будет крешится контроллер или нет.
Или можете попробовать в платформио.ини поправить секцию

[env:espem_debug]
build_flags =
  ${esp32_base.build_flags}
  ${debug.app_serial}

${debug.app_serial} поменять на ${debug.espem_serial} это отключит дебаг фреймворка эмбюи и иставить только дебаг энергомонитора

@vortigont
Copy link
Owner

на всякий случай репозиторий обовляли с прошлой сборки? если нет - удалите папку .pio и соберите заново, я там какие-то фиксы заливал в фреймворк

@Aleks130699
Copy link

Пробовал уже не дебаг версию

@vortigont
Copy link
Owner

ок, я проверю где что обновлялось из компонентов, где-то могло выстрелить

@vortigont
Copy link
Owner

@Aleks130699 вероятно нашел проблему, падение происходит если поле пароля состоит только из цифр. Исправил, удалите каталог .pio, пересоберите и попробуйте. Спасибо за сообщение. Все случаи отловить не получается )

@Aleks130699
Copy link

@vortigont Скачал последний релиз, все завелось сразу, спасибо)

@Aleks130699
Copy link

Aleks130699 commented Jan 29, 2022

Привет, слушай параметр W, в ват часах это же за все время который? я вот понять не могу на tasmote total у меня сейчас был 378 кВч, на на этой прошивке 52 кВч, оно же вроде не должно меняться в зависимости от устройств, а хранится в самой pzem, ну и в целом с момента покупки pzem она посчитала 378 кВч, в сравнении с обычным счетчиком на несколько киловат только разница

@vortigont
Copy link
Owner

да, значения берутся из пзема. Интересно... на своих новых я еще столько не намотал, может напутал с интерпретацией старших байтов. Хотя тогда по току бы тоже сильная погрешность была. Не заметно такого? Вечером проверю.
Заведи баг в этом репозитории и закинь вывод http://espem/getdata

@Aleks130699
Copy link

за день сейчас сравню будут ли расхождения с обычным счетчиком, вечером отпишусь

@Aleks130699
Copy link

Aleks130699 commented Jan 30, 2022

Привет, в общем считало вроде верно, но сегодня смотрю показывает 16квч насчитано, а по графику в умном доме в 21:00 -64квч, т.е пришло практически нулевое значение с модуля

@vortigont
Copy link
Owner

@Aleks130699 добавил настройку, задающую смещение счетчика учета энергии. Можно задать значение чтобы сравнять показания с реальным счетчиком. Особо не тестировал, пока доступно в отдельной ветке.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants