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

Support for M5Stack Core2 planned? #145

Open
kraus-wagner opened this issue Jan 30, 2021 · 78 comments
Open

Support for M5Stack Core2 planned? #145

kraus-wagner opened this issue Jan 30, 2021 · 78 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@kraus-wagner
Copy link

Will you support the new M5Stack Core2?

@sieren
Copy link
Owner

sieren commented Feb 1, 2021

Hey, the Core2 should already be supported.
All it needs is to add "displayColorInverted": true to the configuration file since it's display is wired up a bit differently.

@cerietke
Copy link

cerietke commented Feb 1, 2021

Interesting, not sure you're aware but the Dutch magazine Computer Totaal mentioned your work and they suggested the Core2 implementation wasn't yet ready (https://computertotaal.nl/artikelen/internet-thuis/zo-maak-je-een-eenvoudig-dashboard-voor-je-domoticasysteem/). This is why I got myself a Core. The Core2 with its touchscreen would be way cooler.

I actually found that to get the colors in their article I also had to set the displayColorInverted to true on the Core.

@sieren
Copy link
Owner

sieren commented Feb 1, 2021

Oh, wow. I wasn't aware of this! I guess it's time I order myself a Core2 and tidy this up nicer!

@sieren sieren added the enhancement New feature or request label Feb 1, 2021
@cerietke
Copy link

cerietke commented Feb 1, 2021

Ah, cool. I actually found their description of how to get things up and running pretty helpful at times, it felt slightly more detailed than your own (their demographic includes less experienced users as well). I'm a Product Owner, not a die-hard techy, though I like fiddling around with things, possibly it would be useful if I write something up regarding my experience, as feedback?

@sieren
Copy link
Owner

sieren commented Feb 1, 2021

Absolutely! There's a Wiki here on Github which I sadly have neglected way too much where this could be very useful for!

@cerietke
Copy link

cerietke commented Feb 1, 2021

Where do I send it?

@koenvervloesem
Copy link

Ah, cool. I actually found their description of how to get things up and running pretty helpful at times, it felt slightly more detailed than your own

Thanks, that was the intention of my article, to help non-techies with getting Homepoint up and running :-) Nice to hear that this worked.

In fact, I tried flashing Homepoint to the M5Stack Core2, but the device didn't boot (or at least I didn't see anything), and I didn't have the time then to investigate this further. Maybe the display code needs more changes than just inverting the colors, or maybe it's something else. In the mean time, I have been using my M5Stack Core 2 for another purpose, so I haven't been able to look at it further.

But I agree with the touch screen it would be a very cool device for Homepoint!

@sieren
Copy link
Owner

sieren commented Feb 1, 2021

@koenvervloesem Thanks for the article! :)
I will probably end up creating a special _bin file for M5Stack Core2 after all to make it easier for newcomers.
If I had unlimited resources I'd probably even get rid of the JSON Editor in favour of a modular Web UI.

@cerietke you can mail it to me at matthias (at) s-r-n.de

@sieren
Copy link
Owner

sieren commented Feb 1, 2021

Mijn nederlands is unfortunately not zo goed als dat ik dit en engels vertaalen kan (als en duitser ;)).
I think everyone would probably benefit from these step by step instructions. Super happy to host them and put them prominently on the page first.
I'll make sure to link to the article in the Wiki as well.

@kraus-wagner
Copy link
Author

@koenvervloesem Good article! I read it with google translator. ;-)
@sieren Great project!

I was looking for a touchscreen for an ESP32 or ESP8266 to send mqtt signals to my mosquitto and ioBroker.
It should fit in a wall switch. A common system size in Germany is 55mm (Gira...).
So i found the M5Stack Core2. A perfect gadget. ESP32, touchscreen, perfect size.
First steps in UIflow and Arduino IDE followed. Then i found your project. It is so amazing.
Everything can be controlled by a fingertip with mqtt. I am sure i will love it when it works on the Core2.

@cerietke
Copy link

cerietke commented Feb 1, 2021

Cool that you're also checking in here Koen, I was not aware of homepoint nor the M5Stacks and it covers a lot of nice usecases I was looking for solutions for.

Better stick with English or German ;-). I'll mail you with feedback.

As an experiment I essentially turned the M5Stack Core into a lights and music remote control for my bedroom (receiver is in another room), but I was also thinking about the wall switch replacement option.

@sieren
Copy link
Owner

sieren commented Feb 1, 2021

Thanks!

For Wallswitches, I vaguely recall there was a Kickstarter Project trying to achieve this too:
https://www.kickstarter.com/projects/159751026/23-smarthome-touch-display-w-wlan-for-55mm-switch-series

@kraus-wagner
Copy link
Author

Yes i found that project too. But the Core2 is ready to go. I ordered 2 from digikey.de for 39 Euro each.
https://www.digikey.de/product-detail/de/m5stack-technology-co-ltd/K010/2221-K010-ND/13151126
If your order is over 50 Euro shipping is free. They ship from USA with UPS in 3-4 days. Customs is in the price included.
So i paid 78 Euro total for 2 Core2. Shipping to my door.

@sieren
Copy link
Owner

sieren commented Feb 3, 2021

Received one today, but this will take longer than expected. Can't even get the screen to work right now.
And I need to write a new touch driver from scratch for this

@kraus-wagner
Copy link
Author

I use the Arduino IDE. There i have to change the library from "#include <M5Stack.h>" to "#include <M5Core2.h>" for example to run most code for the Stack on the Core2. I dont know how it works with the Espressif IDE.

@sieren
Copy link
Owner

sieren commented Feb 3, 2021

Yeah. But HomePoint supports multiple platforms with multiple capabilities and introducing dependencies on specific platforms is to be avoided. For it to work on all of them the code has to be generic and abstracted enough, and there come the challenges when a device introduces new components (like Core2 using a different touch-screen handler and moving certain TFT related capabilities to a separate power management chip)

@kraus-wagner
Copy link
Author

Ok i see. It is much more work than changing a library. But i hope you like your Core2 and will have time to make homepoint run on it.

@cerietke
Copy link

cerietke commented Feb 5, 2021

I got one as well, so hoping to see homepoint work on it at some point in the future.
Paid 34+2.50 shipping at tinytronics.nl.

@sieren
Copy link
Owner

sieren commented Feb 5, 2021

IMG_1440

Got the display up and running today, next up Touch Driver support.

If you feel like helping out but lack the programming skills. the best way is a small donation (there's a link at the end of the front page README) as I bought this device just to add compatibility for all the requests.
Personally I don't really have that much need for it.

@jpiscaer
Copy link

jpiscaer commented Feb 6, 2021

Yay! Sitting here at virtual FOSDEM and tinkering with HomePoint and the Core2. Display won't turn on, version 0.6 with displayColorInverted set. Going to wait for a pre-compiled binary core the Core2.

@sieren
Copy link
Owner

sieren commented Feb 6, 2021

homepoint_release.zip

Here's a first beta. Sadly the images dont look super pretty. The Core2 library is sadly also a far-cry from the Core1 one (m5stack/M5Core2#33). Ultimately I might have to tear the Core2 one apart, which might mean lots of more work until things look as good as with other ESP32 devices.

@kraus-wagner
Copy link
Author

I uploaded the new core2 binary and have access to the web interface. I change the config file, so the Core2 is in my wifi network.
But the screen stays dark. I added "displayColorInverted": "true", to the config file and rebooted. Screen stays dark.
Any tips?

@sieren
Copy link
Owner

sieren commented Feb 7, 2021

Sorry. there was a bug in the build script that leads to the binary actually being the same as M5Stack (non-Core2)
homepoint_release.zip

@kraus-wagner
Copy link
Author

Now it works! I made an OTA update and a reboot.
"displayColorInverted": "true", must be removed from config if previously has been added.
Now i can do a little testing ;-)

@sieren
Copy link
Owner

sieren commented Feb 7, 2021

Alright, just implemented proper JPG drawing, so no more artefacts. Did a new release too: https://github.com/sieren/Homepoint/releases/tag/v0.07

If you enjoy this work, please consider donating so I might be able to recoup the Core2 which I bought for this ;)

@jpiscaer
Copy link

jpiscaer commented Feb 8, 2021

Trying to flash 0.07, but after flashing the full (and the OTA), I hear the device constantly booting with a typical 'reset' tick sound. It physically makes noise: ticking and sometimes a high-pitch whining. Screen won't turn on, and no 'homepoint' access point. If I flash back the factory test program with m5burner, the device works. Any idea what's happening? Factory test indicates no hardware problems.
esptool.py write_flash -fs 4MB -fm dout 0x0 homepoint_m5stackcore2_ota_update.bin

@kraus-wagner
Copy link
Author

@jpiscaer

Hi, i first flashed the core2_full binary.
Then connected via the browser to 192.168.99.1 and entered my wifi settings.
Next reconnection via the new ip in my network.
Last i made the OTA update also via the browser frontend.
(screen stays dark during all the time)
After a reboot the screen should work.

@sieren
Copy link
Owner

sieren commented Feb 8, 2021

Oh boy, this looks like a bug. I'll take a look later today.

@sieren
Copy link
Owner

sieren commented May 22, 2021

Awesome..I'll add this. But will keep the x at the top too. As nice as this gesture is, discovery might be an issue.

@sieren
Copy link
Owner

sieren commented May 23, 2021

@cerietke you have to make sure your images are of PNG & 16 bit indexed colors.
Homepoint 2.0 is using black (000000) as a chroma-keyed background, meaning black will become transparent.

Here are a two images from the upcoming release:
exitbutton
livingroom

Worth noting that re-coloring these is now happening on the fly. Eliminating the need to have two separate icons.

@cerietke
Copy link

Ha, I started from JPG. Still unsure how to get paint.net to output as 16 bit indexed, but I'll try later and report back.

@cerietke
Copy link

Though the results look quite terrible I have been able to get it to display an image.

image

This came out as dark grey and black.

@sieren
Copy link
Owner

sieren commented May 23, 2021

Yes, because it's saved as RGB and not Indexed Colors.

Try running this through the converter:
119261359-50080e00-bbd7-11eb-99c7-8ba7b1d54764

@cerietke
Copy link

I'm sure it can be done. But what do you use to get to the correct image? I cannot find the correct option in paint.net. I am happy to use something else. Or am I using the wrong settings on https://lvgl.io/tools/imageconverter ?

@sieren
Copy link
Owner

sieren commented May 23, 2021

Both GIMP and Photoshop can get the job done. (e.g. https://docs.gimp.org/2.10/en/gimp-image-convert-indexed.html )

Your settings seemed right to me

@cerietke
Copy link

Indeed appears like paint.net doesn't have an indexed mode.

@cerietke
Copy link

Trying gimp, when I copy your file it works. When I start from my png it does not.

I do image -> mode -> indexed -> maximum number of colors (16) -> convert, then I export to png (leaving the default settings). There must be something you're doing different than I am.

Besides the images, any insight on the screensaver? I'd plan to use this as a nightstand device, so screen always on would be a no-go. In fact it would be very nice to be able to disable the LED at the bottom and any other lights as well.

@sieren
Copy link
Owner

sieren commented May 24, 2021

Yes, I converted it to Greyscale before going indexed just to make sure there's no colors left in it.
Could be worth a shot?

As for the screensaver: It's coming back at some point. It was a lot of work transitioning to this library and I'm not done yet, I'll do the screensaver pretty soon after cause I'm facing the same problem as you.

@sieren
Copy link
Owner

sieren commented May 24, 2021

Oh, one thing I forgot. I used the "Fill" tool once on the black background of your image since it wasnt really entirely black before. there were a few greyish pixels.

@cerietke
Copy link

cerietke commented May 24, 2021

Tried grayscale -> indexed, also tried with a save in between. Still doesn't show the picture.

I also see a black / white option in indexed, I am thinking to go for that to make absolutely sure it's only black and white.

image

@sieren
Copy link
Owner

sieren commented May 24, 2021

What do you mean with "it doesnt show the picture" ? like, not at all?

@cerietke
Copy link

Yeah, not at all. I also tried to update the json to use it instead of the working picture you provided to confirm it was not a problem with the json.

@sieren
Copy link
Owner

sieren commented May 24, 2021

When you switch over to Indexed, chose Colormap of Image or something, it should be 16 colors in total.

Screenshot 2021-05-24 at 11 27 04

@sieren
Copy link
Owner

sieren commented May 24, 2021

Tried grayscale -> indexed, also tried with a save in between. Still doesn't show the picture.

I also see a black / white option in indexed, I am thinking to go for that to make absolutely sure it's only black and white.

image

This one is an RGB Image. Not Indexed.

@cerietke
Copy link

I literally chose indexed though :(

@sieren
Copy link
Owner

sieren commented May 24, 2021

How do you save these? I opened yours in GIMP and saved it and afterwards double-checked in Photoshop and then it was Indexed.
File -> Export As with the following options:

Screenshot 2021-05-24 at 11 33 23

@cerietke
Copy link

cerietke commented May 24, 2021

I can't choose color map of the image under custom palette.

Btw, if you want to communicate more directly I am happy to. I imagine that a process for others being able to create the images would be important.

I left that at the default settings, looks the same as yours, could it be a Mac vs. Windows issue?

image

@kraus-wagner
Copy link
Author

kraus-wagner commented May 24, 2021

@sieren

Hi Matt,

i tested the new version and it is cool. Swiping is nice. The config file bug seems fixed.

But every 5 minutes my device restarts?

And i have a problem to get temperatures shown. Switching lights works so mqtt seems to work.

topic : kw97/laden_temperatur/tele/SENSOR
{"Time":"2021-05-23T16:15:51","DS18B20":{"Id":"011927068657","Temperature":14.6},"TempUnit":"C"}

Homepoint config:
"type": "singleValue",
"firstIcon": "temperature_small",
"jsondata": true,
"firstKey": "Temperature",
"getTopic": "kw97/laden_temperatur/tele/SENSOR"

Doesn't work. That was the same in the old version, no new problem.

@sieren
Copy link
Owner

sieren commented May 24, 2021

Hey @kraus-wagner, can you paste the whole config?

@cerietke I've just checked with GIMP and using the same workflow in it I've been using in Photoshop results in no icon showing. (Plus GIMP is an absolute dumpster fire...). I'll continue to investigate this.

@cerietke
Copy link

Good to know I am not completely crazy 😉. At least with paint.net I did get an image to show. I'm not a big fan of gimp either, possibly paint.net is more promising?

@sieren
Copy link
Owner

sieren commented May 24, 2021

Screenshot 2021-05-24 at 18 40 22

Maybe? I suppose Paint.Net is what's formerly known as MS Paint? 😅
I dont know whats wrong, but you can try using Paint, just make sure the background is completely black (000000) and maybe change the fill threshhold so it colors "less black" pixels black too that might have occurred due to prior compression.

FWIW I can't even get your image working with Photoshop anymore. Maybe my brain's too fried today. Can you attach your original image to work with?

@cerietke
Copy link

No, it's not MS Paint related. It's getpaint.net btw.

I'm on mobile now, can upload the image tomorrow.

@kraus-wagner
Copy link
Author

{
"wifi": "XXX",
"password": "XXX",
"login": "XXX",
"webpass": "XXX",
"mqttbroker": "mqtt://XXX.XXX.XXX.XXX",
"mqttusername": "XXX",
"mqttpasswd": "XXX",
"timezone": "CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00",
"scenes":
[{
"name": "Esszimmer",
"type": "Light",
"icon": "livingroom",
"devices":
[{
"name": "Stehlampe",
"setTopic": "kw97/esszimmer_stehlampe/cmnd/POWER",
"getTopic": "kw97/esszimmer_stehlampe/stat/POWER",
"onValue": "ON",
"offValue": "OFF",
"icon": "bedroom"
}]
},
{
"name": "Wohnzimmer",
"type": "Light",
"icon": "livingroom",
"devices":
[{
"name": "Stehlampe",
"setTopic": "kw97/wohnzimmer_stehlampe/power",
"getTopic": "kw97/wohnzimmer_stehlampe/power",
"onValue": "1",
"offValue": "0"
}]
},
{
"name": "Temperatur 1",
"type": "Sensor",
"devices":
[{
"name": "Temperatur 1",
"type": "singleValue",
"firstIcon": "temperature_small",
"jsondata": true,
"firstKey": "Temperature",
"getTopic": "kw97/laden_temperatur/tele/SENSOR"
}]
},
{
"name": "Temperatur 2",
"type": "Sensor",
"devices":
[{
"name": "Temperatur 2",
"type": "combinedValues",
"firstIcon": "temperature_small",
"secondIcon": "temperature_small",
"jsondata": true,
"firstKey": "DS18B20-1/Temperature",
"secondKey": "DS18B20-2/Temperature",
"getTopic": "kw97/pool_steuerung/tele/SENSOR"
}]
},
{
"name": "Trockner",
"type": "Sensor",
"devices":
[{
"name": "Tasmota Plug",
"type": "singleValue",
"jsondata": true,
"firstKey": "Power",
"firstIcon":"wattage_small",
"getTopic": "kw97/waschkeller_waeschetrockner/tele/SENSOR"
}]
}]
}

All temperatures and power shows 0.
Switching light works.

@cerietke
Copy link

The image I was starting from:

next_inactive

I realize this isn't strictly black and white.

@Girgitt
Copy link

Girgitt commented Jan 23, 2024

I am not sure if this project is still supported by @sieren but if anyone is interested I made some fixes to the Homepoint v1 (non lvgl-based) version for M5Core2 in my fork: https://github.com/Girgitt/Homepoint/tree/v1-m5core2-fixes

Major issues fixed:

  1. i2c-related crashes with touch display handling due to rx buffer overflow
  2. disabled (for now until I fix it) screensaver which never deactivates

Minor issues fixed:

  1. color conversion from 24b to 16b RRRRRGGGGGGBBBBB format was incorrect

With empty wifi config M5Core2 is still not rock-solid but stable enough to get to the initial config web page to set wifi credentials - just do not refresh the config page multiple times.

With wifi configured you can experience couple crashes on initial access to the config web page but after that it works stable.

My longest test so far was 38h with about 10h with lost wifi connection (I took it to work; mine has battery in the base) and after getting back home wifi reconnected just fine and mqtt was working straight away. Good enough for me.

@cerietke
Copy link

If nobody else I definitely appreciate your effort.

@Girgitt
Copy link

Girgitt commented Feb 11, 2024

OK, I think I am getting somewhere my dev_1_0_2 build (https://github.com/Girgitt/Homepoint/releases/tag/dev_1_0_2) works ok on three different M5Core2 with multiple pages and hierarchies (room->device). I have not tested measurements, only switching lights.
The last thing to get to release would be to disable or make configurable behavior for room with devices - I see no real benefit from splitting the already small tile into areas where upper area navigates to devices and bottom area switches all of them. I think the long press should trigger loads in the room and default behaviour should be to get in the the room by tapping the tile no matter where it is tapped. Added feedback (blinking screen and vibrations) helps a bit with tapping but still most of the cases I would open the room instead of switch everything what is there. Configuration should be per tile so one scenario would be covered: switching scenes when the same loads are arranged into scenes and not rooms.

@Girgitt
Copy link

Girgitt commented Feb 19, 2024

There is one important prerequisite for M5Core2 to work with Homepoint - the touchscreen internal firmware must be in a correct version.

Most of my devices (5 out of 6) had firmware version 0x10 which barely works (detecting short presses only, no responsive at all after longer operation).

The correct version is 0x11.

I described how to check/change the fw in issue: Girgitt#9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

9 participants