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

Make configuring WiFi and MQTT over MQTT optional #986

Closed

Conversation

dkneisz
Copy link
Contributor

@dkneisz dkneisz commented Jun 13, 2021

  • define MQTTsetWIFI for configuring WiFi over MQTT
  • define MQTTsetMQTT for configuring MQTT over MQTT
    Per default both are disabled to save space to OTA flash a Sonoff RF Bridge.
    Fixes issue Issues OTA flashing Sonfoff RF Bridge #985.

- define MQTTsetWIFI for configuring WiFi over MQTT
- define MQTTsetMQTT for configuring MQTT over MQTT
Per default both are disabled to save space to OTA flash a Sonoff RF Bridge.
@dkneisz dkneisz force-pushed the Sonoff_RF_Bridge_OTA_fix branch from 751118a to ba15283 Compare June 13, 2021 08:28
@1technophile 1technophile added this to the v0.9.7 milestone Jun 20, 2021
@1technophile 1technophile linked an issue Jul 7, 2021 that may be closed by this pull request
Comment on lines +44 to +48
Define 'MQTTsetWIFI' to activate this
```
build_flags = '-DMQTTsetWIFI'
```

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this, this function is not impacting a lot the program size

Comment on lines +65 to +68
Define 'MQTTsetMQTT' to activate this
```
build_flags = '-DMQTTsetMQTT'
```
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than defining it as a add, I would prefer to make it default for ESP and remove it for the RFBridge:

[com-esp]
lib_deps =
  ${env.lib_deps}
  ${libraries.wifimanager}
build_flags =
  ${env.build_flags}
  '-DsimpleReceiving=true'
  '-DZmqttDiscovery="HADiscovery"'
  '-DTRACE=1'
  '-DCONFIG_BT_NIMBLE_ROLE_PERIPHERAL_DISABLED'
  '-DCONFIG_BT_NIMBLE_ROLE_BROADCASTER_DISABLED'
  '-DMQTTsetMQTT'
  ;'-DCORE_DEBUG_LEVEL=4'
[env:rfbridge]
platform = ${com.esp8266_platform}
board = esp8285
lib_deps =
  ${com-esp.lib_deps}
  ${libraries.esp8266_mdns}
build_flags =
  ${com-esp.build_flags}
  '-DZgatewaySRFB="SRFB"'
  '-DLED_INFO=13'
  '-DLED_INFO_ON=0'
  '-DGateway_Name="OpenMQTTGateway_SRFB"'
  '-UMQTTsetMQTT' ;We remove this function to have sufficient FLASH available for OTA, you should also use ESPWifiManualSetup to save flash memory and have OTA working
board_build.flash_mode = dout

Comment on lines +1801 to 1802
# ifdef MQTTsetWIFI
if (SYSdata.containsKey("wifi_ssid") && SYSdata.containsKey("wifi_pass")) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose to remove it

@1technophile 1technophile mentioned this pull request Jul 14, 2021
3 tasks
@1technophile
Copy link
Owner

Forked and modification applied on #1021, thanks for seeing this!

@1technophile 1technophile removed this from the v0.9.7 milestone Jul 14, 2021
1technophile pushed a commit that referenced this pull request Aug 2, 2021
…1046)

* Disable MQTTsetMQTT and MQTT_HTTPS_FW_UPDATE to allow OTA for Avatto Bakery IR

Trying to update my Avattos with the currently released 0.9.8 I found that OTA wasn't possible any longer as the build was now to large

0.9.8
Checking size .pio/build/avatto-bakeey-ir/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [====      ]  42.4% (used 34772 bytes from 81920 bytes)
Flash: [======    ]  55.2% (used 528716 bytes from 958448 bytes)

this goes back to 0.9.7, where WiFi, MQTT and firmware update was introduced over MQTT commands

0.9.7
Checking size .pio/build/avatto-bakeey-ir/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [====      ]  42.4% (used 34772 bytes from 81920 bytes)
Flash: [======    ]  55.2% (used 528716 bytes from 958448 bytes)

Going back to building 0.9.6 I was able to OTA update again with the much smaller build

0.9.6
Checking size .pio/build/avatto-bakeey-ir/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [====      ]  39.7% (used 32512 bytes from 81920 bytes)
Flash: [====      ]  41.4% (used 396804 bytes from 958448 bytes)

Building 0.9.8 with the flags brings the build back to OTAable size

0.9.8 with
	'-UMQTTsetMQTT'
	'-UMQTT_HTTPS_FW_UPDATE'
Checking size .pio/build/avatto-bakeey-ir/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [====      ]  39.9% (used 32684 bytes from 81920 bytes)
Flash: [====      ]  42.3% (used 405024 bytes from 958448 bytes)

Similar to the flag setting in [env:rfbridge]

I'm not even sure if MQTT_HTTPS_FW_UPDATE would even work on the Avatto, with the limited flash memory. 

Should we also add

board_build.ldscript = eagle.flash.1m64.ld

as a default, as it's required for OTA updates on the Avattos as discussed in #763 (comment) ?

* Doc addition for restricted MQTT options

Doc addition for #1046 and #986
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues OTA flashing Sonfoff RF Bridge
2 participants