Skip to content

Commit

Permalink
Berry add tasmota.urlbecload(url:string) -> bool (arendst#20412)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-hadinger authored and hawa-lc4 committed Jan 20, 2024
1 parent 0937175 commit ed8e475
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
### Added
- HASPmota type `chart` (#20372)
- Berry add support for `tcpclientasync` in `tcpserver`
- Berry add `tasmota.urlbecload(url:string) -> bool`

### Breaking Changed

Expand Down
5 changes: 5 additions & 0 deletions lib/libesp32/berry_tasmota/src/be_tasmota_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "be_constobj.h"
#include "be_ctypes.h"
#include "be_mapping.h"
#include "be_ctypes.h"

extern struct TasmotaGlobal_t TasmotaGlobal;
extern struct TSettings * Settings;
Expand Down Expand Up @@ -69,6 +70,9 @@ extern int tasm_apply_str_op(bvm *vm);
extern int32_t be_Tasmota_version(void);
BE_FUNC_CTYPE_DECLARE(be_Tasmota_version, "i", "-");

extern bbool BerryBECLoader(const char * url);
BE_FUNC_CTYPE_DECLARE(BerryBECLoader, "b", "s")

#include "solidify/solidified_tasmota_class.h"
#include "solidify/solidified_rule_matcher.h"
#include "solidify/solidified_trigger_class.h"
Expand Down Expand Up @@ -177,6 +181,7 @@ class be_class_tasmota (scope: global, name: Tasmota) {
time_str, closure(Tasmota_time_str_closure)
urlfetch, closure(Tasmota_urlfetch_closure)
urlfetch_cmd, closure(Tasmota_urlfetch_cmd_closure)
urlbecload, static_ctype_func(BerryBECLoader)
add_cron, closure(Tasmota_add_cron_closure)
run_cron, closure(Tasmota_run_cron_closure)
Expand Down
3 changes: 2 additions & 1 deletion tasmota/tasmota_xdrv_driver/xdrv_52_9_berry.ino
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@ void HandleBerryPartiionWizardLoaderButton(void) {
}
}

extern "C" bbool BerryBECLoader(const char * url);
void HandleBerryPartitionWizardLoader(void) {
if (BerryBECLoader(USE_BERRY_PARTITION_WIZARD_URL)) {
// All good, redirect
Expand All @@ -792,7 +793,7 @@ void HandleBerryPartitionWizardLoader(void) {
#endif //USE_BERRY_PARTITION_WIZARD

// return true if successful
bool BerryBECLoader(const char * url) {
extern "C" bbool BerryBECLoader(const char * url) {
bvm *vm = berry.vm;

HTTPClientLight cl;
Expand Down

0 comments on commit ed8e475

Please # to comment.