Skip to content

Commit f2f935a

Browse files
committed
Merge branch 'release/v0.4.6' into main
2 parents e527a38 + 58aec3d commit f2f935a

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
needs: release
3232
strategy:
3333
matrix:
34-
hwModel: [Shelly1, Shelly1PM, ShellyPlugS, ShellyPlug2, ShellyUni, Shelly2, Shelly25, ShellyRGBW2, ShellyDimmer1, ShellyDimmer2, ShellyEM, ShellyBulb, ShellyVintage, ShellyPlugUS, ShellyHT, ShellyDuo, ShellyI3, Shelly1L]
34+
hwModel: [Shelly1, Shelly1PM, ShellyPlugS, ShellyPlug2, ShellyUni, Shelly2, Shelly25, ShellyRGBW2, ShellyDimmer1, ShellyDimmer2, ShellyEM, ShellyBulb, ShellyVintage, ShellyPlugUS, ShellyHT, ShellyDuo, ShellyI3, Shelly1L, ShellyDuoRGBW]
3535
hwPlatform: [esp8266]
3636
targetFw: [tasmota, haa, espurna]
3737
runs-on: ubuntu-latest

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,23 @@ Device | Update URL | Tasmota Template
5656
--- | --- | ---
5757
Shelly 1 | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-Shelly1.zip` | `{"NAME":"Shelly 1","GPIO":[0,0,0,0,21,82,0,0,0,0,0,0,0],"FLAG":0,"BASE":46}`
5858
Shelly 1PM | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-Shelly1PM.zip` | `{"NAME":"Shelly 1PM","GPIO":[56,0,0,0,82,134,0,0,0,0,0,21,0],"FLAG":2,"BASE":18}`
59-
Shelly Plug S | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-ShellyPlugS.zip` | `{"NAME":"Shelly Plug S","GPIO":[57,255,56,255,0,134,0,0,131,17,132,21,0],"FLAG":2,"BASE":45}`
59+
Shelly Plug S | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-ShellyPlugS.zip` | `{"NAME":"Shelly Plug S","GPIO":[56,255,158,255,255,134,0,0,131,17,132,21,255],"FLAG":2,"BASE":45}`
6060
Shelly 2 | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-Shelly2.zip` | `{"NAME":"Shelly 2","GPIO":[0,135,0,136,21,22,0,0,9,0,10,137,0],"FLAG":0,"BASE":47}`
6161
Shelly 2.5 | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-Shelly25.zip` | `{"NAME":"Shelly 2.5","GPIO":[56,0,17,0,21,83,0,0,6,82,5,22,156],"FLAG":2,"BASE":18}`
6262
Shelly RGBW2 (color mode, latest firmware needed) | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-ShellyRGBW2.zip` | `{"NAME":"Shelly RGBW2","GPIO":[0,0,52,0,40,255,0,0,37,17,39,38,0],"FLAG":0,"BASE":18}`
63-
Shelly Dimmer 1 | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-ShellyDimmer1.zip` | `{"NAME":"Shelly Dimmer 1","GPIO":[0,3200,0,3232,5504,5536,0,0,192,0,193,288,0,4736],"FLAG":0,"BASE":18}`
64-
Shelly Dimmer 2 | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-ShellyDimmer2.zip` | `{"NAME":"Shelly Dimmer 2","GPIO":[0,3200,0,3232,5504,5536,0,0,193,0,192,0,320,4736],"FLAG":0,"BASE":18}`
63+
Shelly Dimmer 1 | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-ShellyDimmer1.zip` | `{"NAME":"Shelly Dimmer 1","GPIO":[0,3200,0,3232,5568,5600,0,0,192,0,193,288,0,4736],"FLAG":0,"BASE":18}`
64+
Shelly Dimmer 2 | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-ShellyDimmer2.zip` | `{"NAME":"Shelly Dimmer 2","GPIO":[0,3200,0,3232,5568,5600,0,0,193,0,192,0,320,4736],"FLAG":0,"BASE":18}`
6565
Shelly EM | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-ShellyEM.zip` | `{"NAME":"Shelly EM","GPIO":[0,0,0,0,0,0,0,0,6,156,5,21,0],"FLAG":15,"BASE":18}`
6666
Shelly Bulb | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-ShellyBulb.zip` | **not yet available, only flash if you a perfectly certain about what you are doing**
6767
Shelly Vintage | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-ShellyVintage.zip` | **not yet available, only flash if you a perfectly certain about what you are doing**
68-
Shelly Plug US | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-ShellyPlugUS.zip` | `{"NAME":"ShellyPlugUS","GPIO":[52,255,57,255,21,134,0,0,131,17,132,157,0],"FLAG":0,"BASE":45}`
68+
Shelly Plug US | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-ShellyPlugUS.zip` | `{"NAME":"Shelly Plug US","GPIO":[52,0,57,0,21,134,0,0,131,17,132,157,0],"FLAG":0,"BASE":45}`
6969
Shelly Duo | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-ShellyDuo.zip` | `{"NAME":"Shelly Duo","GPIO":[0,0,0,0,38,37,0,0,0,0,0,0,0],"FLAG":0,"BASE":18}`
7070
Shelly H&T | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-ShellyHT.zip` | **not yet available, only flash if you a perfectly certain about what you are doing**
7171
Shelly i3 | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-ShellyI3.zip` | `{"NAME":"Shelly i3","GPIO":[0,0,0,0,0,0,0,0,83,84,82,0,0],"FLAG":2,"BASE":18}`
7272
Shelly 1L | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-Shelly1L.zip` | `{"NAME":"Shelly 1L","GPIO":[320,0,0,0,192,224,0,0,0,0,193,0,0,4736],"FLAG":0,"BASE":18}`
7373
Shelly Plug 2 | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-ShellyPlug2.zip` | **not yet available, only flash if you a perfectly certain about what you are doing**
7474
Shelly Uni | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-ShellyUni.zip` | `{"NAME":"Shelly Uni","GPIO":[320,0,0,0,225,0,0,0,192,193,0,224,0,4864],"FLAG":0,"BASE":18}`
75+
Shelly Duo RGBW | `http://shellyip/ota?url=http://dl.dasker.eu/firmware/mg2tasmota-ShellyDuoRGBW.zip` | **not yet available, only flash if you a perfectly certain about what you are doing**
7576

7677
For your convenience, the table above also lists the matching Tasmota device
7778
templates from [templates.blakadder.com](https://templates.blakadder.com) which

mos.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
author: mark dornbach <[email protected]>
22
description: a minimal firmware for ota flashing tasmota from mongoose os
33
platform: esp8266
4-
version: 0.4.4
4+
version: 0.4.6
55

66
libs_version: ${mos.version}
77
modules_version: ${mos.version}
@@ -190,3 +190,11 @@ conds:
190190
FLASH_SIZE: 2097152
191191
BOOT_CONFIG_ADDR: 0x1000
192192
MGOS_ROOT_FS_TYPE: SPIFFS
193+
- when: build_vars.MODEL == "ShellyDuoRGBW"
194+
apply:
195+
name: color-bulb
196+
build_vars:
197+
FS_SIZE: 262144
198+
FLASH_SIZE: 2097152
199+
BOOT_CONFIG_ADDR: 0x1000
200+
MGOS_ROOT_FS_TYPE: SPIFFS

src/main.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ rboot_config *rboot_cfg;
3030
length block length / byte
3131
*/
3232
void block_copy(uint32 src, uint32 dest, uint32 length) {
33-
LOG(LL_DEBUG, ("block_copy start: cp %d bytes from 0x%x to 0x%x", length, src, dest));
33+
LOG(LL_DEBUG, ("block_copy start: cp %lu bytes from 0x%lx to 0x%lx", length, src, dest));
3434
uint32 chunk = CHUNK_SIZE, offset = 0;
3535
bool done = false;
3636
char *data = NULL;
@@ -117,13 +117,13 @@ static void http_cb(struct mg_connection *c, int ev, void *ev_data, void *ud) {
117117
}
118118

119119
if ( spi_flash_erase_sector(state->curr_blk) != 0 ) {
120-
LOG(LL_ERROR, ("flash delete error! abort at %d recieved bytes.", state->recieved));
120+
LOG(LL_ERROR, ("flash delete error! abort at %lu recieved bytes.", state->recieved));
121121
c->flags |= MG_F_CLOSE_IMMEDIATELY;
122122
state->status = 500;
123123
break;
124124
}
125125
if ( spi_flash_write( state->curr_blk * BLOCK_SIZE, (uint32 *) state->data, BLOCK_SIZE) != 0 ) {
126-
LOG(LL_ERROR, ("flash write error! abort at %d recieved bytes.", state->recieved));
126+
LOG(LL_ERROR, ("flash write error! abort at %lu recieved bytes.", state->recieved));
127127
c->flags |= MG_F_CLOSE_IMMEDIATELY;
128128
state->status = 500;
129129
break;
@@ -141,7 +141,7 @@ static void http_cb(struct mg_connection *c, int ev, void *ev_data, void *ud) {
141141
if (hm->resp_code == 302) {
142142
// follow http redirect ...
143143
for (int i = 0; i < MG_MAX_HTTP_HEADERS; i++) {
144-
if ( mg_strstr(hm->header_names[i], mg_mk_str("location") ) != NULL ) {
144+
if ( mg_strcasecmp(hm->header_names[i], mg_mk_str("location") ) == 0 ) {
145145
LOG(LL_DEBUG, ("302 redirect to %.*s", hm->header_values[i].len, hm->header_values[i].p));
146146

147147
char *url;
@@ -159,16 +159,16 @@ static void http_cb(struct mg_connection *c, int ev, void *ev_data, void *ud) {
159159
break;
160160
case MG_EV_CLOSE:
161161
// executed upon close connection
162-
LOG(LL_INFO, ("HTTP status is %d, recieved %d bytes", state->status, state->recieved));
162+
LOG(LL_INFO, ("HTTP status is %d, recieved %lu bytes", state->status, state->recieved));
163163
if (state->status == 200) {
164164
// write last block
165165
if ( spi_flash_erase_sector(state->curr_blk) != 0 ) {
166-
LOG(LL_ERROR, ("flash delete error! abort at %d recieved bytes.", state->recieved));
166+
LOG(LL_ERROR, ("flash delete error! abort at %lu recieved bytes.", state->recieved));
167167
break;
168168
}
169169
state->left_in_block = ( (state->curr_blk + 1) * BLOCK_SIZE ) - state->dest - state->recieved;
170170
if ( spi_flash_write( state->curr_blk * BLOCK_SIZE, (uint32 *) state->data, BLOCK_SIZE - state->left_in_block) != 0 ) {
171-
LOG(LL_ERROR, ("flash write error! abort at %d recieved bytes.", state->recieved));
171+
LOG(LL_ERROR, ("flash write error! abort at %lu recieved bytes.", state->recieved));
172172
break;
173173
}
174174
LOG(LL_DEBUG, ("last block dump done"));
@@ -250,7 +250,7 @@ void download_file_to_flash(const char *url, uint32 dest) {
250250
state->recieved = 0;
251251
state->curr_blk = dest / BLOCK_SIZE;
252252

253-
LOG(LL_DEBUG, ("fetching %s to 0x%x", url, dest));
253+
LOG(LL_DEBUG, ("fetching %s to 0x%lx", url, dest));
254254
mg_connect_http(mgos_get_mgr(), http_cb, state, url, NULL, NULL);
255255
return;
256256
};

0 commit comments

Comments
 (0)