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

Module automatically restarts after setting displaywidth 64 #6740

Closed
ajitam opened this issue Oct 25, 2019 · 23 comments · Fixed by #8012
Closed

Module automatically restarts after setting displaywidth 64 #6740

ajitam opened this issue Oct 25, 2019 · 23 comments · Fixed by #8012
Assignees
Labels
enhancement Type - Enhancement that will be worked on fixed Result - The work on the issue has ended
Milestone

Comments

@ajitam
Copy link

ajitam commented Oct 25, 2019

BUG DESCRIPTION

Module automatically restarts after setting displaywidth 64

REQUESTED INFORMATION

  • Device used (e.g., Sonoff Basic): WeMos D1 + 64 x 48 pixel OLED display SSD1306

  • Self-compiled

  • IDE / Compiler used: pio

  • Flashing tools used: pio run -t upload

  • Tasmota binary firmware version number used:

  • Provide the output of command: Backlog Template; Module; GPIO:

CMD: Backlog Template; Module; GPIO
MQT: /device/sonoff/stat/RESULT = {"NAME":"Generic","GPIO":[255,255,255,255,255,255,255,255,255,255,255,255,255],"FLAG":15,"BASE":18}
MQT: /device/sonoff/stat/RESULT = {"Module":{"18":"Generic"}}
MQT: /device/sonoff/stat/RESULT = {"GPIO0":{"0":"None"},"GPIO1":{"0":"None"},"GPIO2":{"0":"None"},"GPIO3":{"0":"None"},"GPIO4":{"0":"None"},"GPIO5":{"5":"I2C SCL"},"GPIO12":{"6":"I2C SDA"},"GPIO13":{"0":"None"},"GPIO14":{"0":"None"},"GPIO15":{"0":"None"},"GPIO16":{"0":"None"}}
  • Provide the output of this command: Status 0:
CMD: status 0
MQT: /device/sonoff/stat/STATUS = {"Status":{"Module":18,"FriendlyName":["sonoff-X-X"],"Topic":"sonoff-blank","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0}}
MQT: /device/sonoff/stat/STATUS1 = {"StatusPRM":{"Baudrate":115200,"GroupTopic":"sonoffs","OtaUrl":"","RestartReason":"Software/System restart","Uptime":"0T00:02:58","StartupUTC":"2019-10-25T11:49:35","Sleep":50,"CfgHolder":4624,"BootCount":5,"SaveCount":17,"SaveAddress":"FB000"}}
MQT: /device/sonoff/stat/STATUS2 = {"StatusFWR":{"Version":"6.7.0(sonoff)","BuildDateTime":"2019-10-25T13:44:16","Boot":31,"Core":"STAGE","SDK":"2.2.2-dev(38a443e)"}}
MQT: /device/sonoff/stat/STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"MqttLog":0,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["xxx",""],"TelePeriod":300,"Resolution":"558180C0","SetOption":["00008009","2805C8000100060000005A00000000000000","00000000"]}}
MQT: /device/sonoff/stat/STATUS4 = {"StatusMEM":{"ProgramSize":600,"Free":400,"Heap":21,"ProgramFlashSize":1024,"FlashSize":4096,"FlashChipId":"16301C","FlashMode":3,"Features":["00000809","8FFAE397","043683A0","22B617CD","01001BC0","00007081"],"Drivers":"1,2,3,4,5,6,7,8,9,10,12,13,16,18,19,20,21,22,24,26","Sensors":"1,2,3,4,5,6,7,8,9,10,14,15,17,18,20,22,26,34"}}
MQT: /device/sonoff/stat/STATUS5 = {"StatusNET":{"Hostname":"sonoff-blank-5156","IPAddress":"192.168.22.126","Gateway":"192.168.22.1","Subnetmask":"255.255.255.0","DNSServer":"212.18.32.10","Mac":"2C:F4:32:2D:B4:24","Webserver":2,"WifiConfig":4}}
MQT: /device/sonoff/stat/STATUS6 = {"StatusMQT":{"MqttHost":"broker","MqttPort":1883,"MqttClientMask":"sonoff_%06X","MqttClient":"sonoff_2DB424","MqttUser":"xxx","MqttCount":1,"MAX_PACKET_SIZE":1000,"KEEPALIVE":30}}
MQT: /device/sonoff/stat/STATUS7 = {"StatusTIM":{"UTC":"Fri Oct 25 11:52:33 2019","Local":"Fri Oct 25 12:52:33 2019","StartDST":"Sun Mar 31 02:00:00 2019","EndDST":"Sun Oct 27 03:00:00 2019","Timezone":"+01:00","Sunrise":"06:31","Sunset":"16:59"}}
MQT: /device/sonoff/stat/STATUS10 = {"StatusSNS":{"Time":"2019-10-25T12:52:33"}}
MQT: /device/sonoff/stat/STATUS11 = {"StatusSTS":{"Time":"2019-10-25T12:52:33","Uptime":"0T00:02:58","UptimeSec":178,"Heap":20,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"OFF","Wifi":{"AP":1,"SSId":"xxx","BSSId":"xxx","Channel":9,"RSSI":68,"LinkCount":1,"Downtime":"0T00:00:05"}}}

  • Console log output
12:28:20 CMD: display
12:28:20 MQT: /device/sonoff-blank/stat/RESULT = {"Display":{"Model":2,"Width":128,"Height":64,"Mode":0,"Dimmer":15,"Size":1,"Font":1,"Rotate":0,"Refresh":2,"Cols":[1,8],"Rows":1}}
12:28:33 CMD: displaywidth
12:28:33 MQT: /device/sonoff-blank/stat/RESULT = {"DisplayWidth":128}
12:28:39 CMD: displaywidth 64
12:28:39 MQT: /device/sonoff-blank/stat/RESULT = {"DisplayWidth":64}
12:28:41 APP: Restarting

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v645464ca
~ld

00:00:00 CFG: Loaded from flash at F7, Count 49
00:00:00 Project sonoff-blank sonoff-X-X Version 6.6.0.21(sonoff)-STAGE
00:00:00 WIF: Connecting to AP1 ...

TO REPRODUCE

in console write

displaywidth 64

EXPECTED BEHAVIOUR

Should not restart? :)

p.s.: never been so scared to open the issue 🤞

@ascillato
Copy link
Contributor

ascillato commented Oct 25, 2019

Hi, please update to latest Tasmota version

https://github.com/arendst/Sonoff-Tasmota/releases/download/v6.7.0/sonoff-display.bin

@ascillato
Copy link
Contributor

If after updating, your issue remains, do a reset 5 to delete all flash settings and start over.

If that don't solve your issue, please complete the template. You have deleted all the useful information we need (Tasmota version, status 0 output, etc etc.) without that information we can't help you

@ascillato2 ascillato2 added template missing/incomplete Action - Template Missing or incomplete (issue will be closed) troubleshooting Type - Troubleshooting labels Oct 25, 2019
@ascillato2
Copy link
Collaborator

Looking into the code, the restart is ok to apply the new settings.

@ajitam
Copy link
Author

ajitam commented Oct 25, 2019

  1. I have updated the issue description (sorry)
  2. I updated the SW (to 6.7.0(sonoff))
  3. i did restart 5

If restart is OK, then issue is that settings are not stored

@ajitam
Copy link
Author

ajitam commented Oct 25, 2019

13:00:54 CMD: display
13:00:54 MQT: /device/sonoff/stat/RESULT = {"Display":{"Model":2,"Width":128,"Height":64,"Mode":1,"Dimmer":1,"Size":1,"Font":1,"Rotate":0,"Refresh":2,"Cols":[16,8],"Rows":2}}
13:01:02 CMD: displaywidth 64
13:01:02 MQT: /device/sonoff/stat/RESULT = {"DisplayWidth":64}
13:01:03 APP: Restarting

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v645464ca
~ld

00:00:00 CFG: Loaded from flash at F9, Count 19
00:00:00 Project sonoff sonoff-X-X Version 6.7.0(sonoff)-STAGE
00:00:04 WIF: Connected
13:01:10 MQT: Attempting connection...
13:01:10 MQT: Connected
13:01:10 MQT: /device/sonoff/tele/LWT = Online (retained)
13:01:10 MQT: /device/sonoff/cmnd/POWER =
13:01:10 MQT: /device/sonoff/tele/INFO1 = {"Module":"Generic","Version":"6.7.0(sonoff)","FallbackTopic":"cmnd/sonoff_2DB424_fb/","GroupTopic":"sonoffs"}
13:01:10 MQT: /device/sonoff/tele/INFO2 = ...
13:01:10 MQT: /device/sonoff/tele/INFO3 = {"RestartReason":"Software/System restart"}
13:01:10 MQT: /device/sonoff/stat/RESULT = {"POWER":"OFF"}
13:01:10 MQT: /device/sonoff/stat/POWER = OFF
13:01:16 CMD: display
13:01:16 MQT: /device/sonoff/stat/RESULT = {"Display":{"Model":2,"Width":128,"Height":64,"Mode":1,"Dimmer":1,"Size":1,"Font":1,"Rotate":0,"Refresh":2,"Cols":[16,8],"Rows":2}}

@ascillato
Copy link
Contributor

You did a restart 5,sorry that is not a Tasmota command.

Please, do a reset 5 to clear flash memory for any wrong remaining data from Initial flash and start over with the configuration. Reset 5 will preserve your wifi settings.

@ascillato
Copy link
Contributor

ascillato commented Oct 25, 2019

And for testing (just to avoid any compilation issue) please update to the precompiled bin with display support: https://github.com/arendst/Sonoff-Tasmota/releases/download/v6.7.0/sonoff-display.bin

You can update by OTA (from Tasmota web UI)

@ajitam
Copy link
Author

ajitam commented Oct 28, 2019

I tried everything with no luck (I will try a new wemos).

@arendst
Copy link
Owner

arendst commented Oct 28, 2019

I'll have a look now...

@arendst
Copy link
Owner

arendst commented Oct 28, 2019

The current code does only support 96 or 128 pixels.

I'll change it to support 64 too and let you know when to test.

@arendst
Copy link
Owner

arendst commented Oct 28, 2019

Sorry for you but the used Adafruit display driver library does NOT support width 64 x 48.

The only supported sizes are 96 x 16, 128 x 32 and 128 x 64

So I cannot solve this.

@arendst
Copy link
Owner

arendst commented Oct 28, 2019

As you compile yourself you might want to try this:

In file lib/Adafruit_SSD1306-1.3.0-gemu-1.1/Adafruit_SSD1306.cpp change lines 566 to 568 from

  } else {
    // Other screen varieties -- TBD
  }

in

  } else if((WIDTH == 64) && (HEIGHT == 48)) {
    static const uint8_t PROGMEM init4d[] = {
      SSD1306_SETCOMPINS,                 // 0xDA
      0x12,
      SSD1306_SETCONTRAST };              // 0x81
    ssd1306_commandList(init4d, sizeof(init4d));
    ssd1306_command1((vccstate == SSD1306_EXTERNALVCC) ? 0x10 : 0xCF);
  } else {
    // Other screen varieties -- TBD
  }

and in file sonoff/xdsp_02_ssd1306.ino lines 64 to 69 in

    if ((Settings.display_width != 64) && (Settings.display_width != 96) && (Settings.display_width != 128)) {
      Settings.display_width = 128;
    }
    if ((Settings.display_height != 16) && (Settings.display_height != 32) && (Settings.display_height != 48) && (Settings.display_height != 64)) {
      Settings.display_height = 64;
    }

and report back the results.

@arendst arendst reopened this Oct 28, 2019
@arendst arendst added awaiting feedback Action - Waiting for response or more information and removed template missing/incomplete Action - Template Missing or incomplete (issue will be closed) labels Oct 28, 2019
@mike2nl
Copy link
Contributor

mike2nl commented Oct 28, 2019

@arendst
yes the 64 pixel width was misiing.
In the library from mcauser for wemos oled 64x48 it is inserted:
-> https://github.com/mcauser/Adafruit_SSD1306/tree/esp8266-64x48

The library works with the PCB version: v1.1.0, v2.0.0 and v2.1.0 (current)
I use the PCB versions: 2.0.0 and 2.1.0.

In the default Adafruit and gemu's one it wasn't.
I had changed it myself some time ago and forget the PR, argh.

@ajitam
Copy link
Author

ajitam commented Oct 29, 2019

aha ok, there was no note in the documentation about this.
In the meanwhile I "guess" the offset so it is not that hard to just offset the content without changing the code, for example:

DisplayText [z];
DisplayText [x33y0f1]Line 1
DisplayText [x33y11r64:1]
DisplayText [x33y13f1]Line 2
DisplayText [x33y24r64:1]
DisplayText [x33y26f1]Line 3
DisplayText [x33y37r64:1]
DisplayText [x33y39f1]Line 4

Just x is offset for 33

@mike2nl so if understand correctly you will push the code to support 64x48?

@arendst do I close this?

@arendst
Copy link
Owner

arendst commented Oct 29, 2019

Pls leave open for me to remember to put the change in the production code.

@arendst arendst added enhancement Type - Enhancement that will be worked on and removed awaiting feedback Action - Waiting for response or more information troubleshooting Type - Troubleshooting labels Oct 29, 2019
@mike2nl
Copy link
Contributor

mike2nl commented Oct 29, 2019

@ajitam
because a PR...

  • When @arendst will add it i don't have todo a PR because he is the master of all code ;-).

@arendst arendst added this to the v7.1.0 milestone Oct 29, 2019
arendst added a commit that referenced this issue Oct 30, 2019
Add SSD1306 64x48 pixel support (#6740)
@arendst arendst added the fixed Result - The work on the issue has ended label Oct 30, 2019
@ascillato2
Copy link
Collaborator

@ajitam

Hi,

Your request has been added. Please, test it and if it works, close this issue. Thanks.

@mike2nl
Copy link
Contributor

mike2nl commented Oct 31, 2019

@ascillato2
i can test it too because i have all the available hardware for the D1 Mini series shileds.
Until the weekend it must be done and i will report so far the issue is still open.

@ascillato2
Copy link
Collaborator

Closing this issue as this feature has been added. Thanks 👍

@ajitam
Copy link
Author

ajitam commented Nov 4, 2019

Width and height can be set now

10:17:10 MQT: /device/sonoff-blank/stat/RESULT = {"Display":{"Model":2,"Width":64,"Height":48,"Mode":0,"Dimmer":15,"Size":1,"Font":1,"Rotate":0,"Refresh":2,"Cols":[16,8],"Rows":2}}

But when I do DisplayText [x0y0r64:48], square is drawn from x:32 y:0. In other words x axis is at the middle of the screen...

Is there any option/command for this?

@krijnenr
Copy link

krijnenr commented Nov 8, 2019

I can confirm x0y0 is off screen (shift 32 pixels)

Updated the Adafruit_SSD1306.cpp file with code below

void Adafruit_SSD1306::display(void) {
uint8_t col_start = 0;
uint8_t col_end = WIDTH - 1;
if (WIDTH == 64) {
col_start += 32;
col_end += 32;
}

TRANSACTION_START
static const uint8_t PROGMEM dlist1[] = {
SSD1306_PAGEADDR,
0, // Page start address
0xFF, // Page end (not really, but works here)
SSD1306_COLUMNADDR };
ssd1306_commandList(dlist1, sizeof(dlist1));
ssd1306_command1(col_start); // Column start address
ssd1306_command1(col_end); // Column end address

@tdemalliard
Copy link

I confirm Krijnenr solution is working for me : wemos d1 mini + oled 64x48 v1.1.0.

I compiled it from release 8.1.0.1.

@xbmcnut
Copy link

xbmcnut commented Mar 11, 2020

@tdemalliard Can you please confirm your display settings for me? I'm using the same display but DisplayText [x0y0r64:48] starts the draw well off to the left of the screen. If I try DisplayText [x33y39f1]Line 4, I just get Line and nothing else. I'm running a stock dev build 8.1.0.10

s-hadinger added a commit to s-hadinger/Tasmota that referenced this issue Mar 27, 2020
arendst added a commit that referenced this issue Mar 27, 2020
Add support for 64x48 SSD1306 OLED (#6740)
IATkachenko pushed a commit to IATkachenko/Tasmota that referenced this issue Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Type - Enhancement that will be worked on fixed Result - The work on the issue has ended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants