@gordsh in your code, is the press function working successfully?
i am getting crashes for now, i am trying to use the button as a external button and not as a encoder button, the main problems seems to be init of button
Best posts made by mukul_100_
-
RE: M5Dial TFT_eSPI pinout
Latest posts made by mukul_100_
-
SPI on M5dial but i cannot use I2C port
Hello all,
right now im developing such a project that requires a two temperature sensor PT1000 and to convert RTD values to signals we are using two MAX31865 which is based on SPI. we are stuck at how to use SPI on m5dial as i cannot use the I2C port's GPIOs so im stuck with only two GPIOs of port B,
The problem arises because we have to write configuration register into the MAX IC which will be done with MOSI. And MISO is used for continous inputs from sensor.
Since there is no real option i am planning to place these on the port B and since we already have used a IO expander via I2C i can put CS for both the ICs on there but the SCLK is a major problem as i would have liked use it on GPIO straight but rather i will have to bit bang it.
Does anyone have any other ideas on how i can implement this?
Thank you. -
RE: M5Dial TFT_eSPI pinout
@gordsh in your code, is the press function working successfully?
i am getting crashes for now, i am trying to use the button as a external button and not as a encoder button, the main problems seems to be init of button -
RE: M5Dial TFT_eSPI pinout
@gordsh Oh great thanks a lot, I actually got it working,
and after seeing your code i tried to implement the button part with encoder but the dial seems to crash repeatedly because of it. For now that is not my focus so i will try it again later.
Also , do you have any idea how the implementation of encoder is eez studio is.
i understood that the group is to be made but didnt quite understand how to append/impelment the encoder events to it
If anyone has any idea or reference, Thank you in advance.also this is the code for how i implemented the button press with encoder
// Encoder read function void encoder_read(lv_indev_drv_t *drv, lv_indev_data_t *data) { long newPosition = M5Dial.Encoder.read() / 4; // Normalize encoder position if (newPosition != oldPosition) { int encoderDiff = newPosition - oldPosition; oldPosition = newPosition; // React to encoder rotation if (encoderDiff > 0) { lv_group_focus_next(group); } else if (encoderDiff < 0) { lv_group_focus_prev(group); } } // Check button press if (M5Dial.BtnA.wasPressed()) { data->state = LV_INDEV_STATE_PR; Serial.println("M5.BtnA Pressed"); } else { data->state = LV_INDEV_STATE_REL; } } // Display flush function void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) { uint32_t width = (area->x2 - area->x1 + 1); uint32_t height = (area->y2 - area->y1 + 1); M5.Display.startWrite(); M5.Display.setAddrWindow(area->x1, area->y1, width, height); M5.Display.pushPixels((uint16_t *)&color_p->full, width * height, true); M5.Display.endWrite(); lv_disp_flush_ready(disp); } void setup() { auto cfg = M5.config(); M5Dial.begin(cfg, true, false); Serial.begin(115200); // LVGL initialization lv_init(); lv_disp_draw_buf_init(&drawBuffer, buffer, NULL, SCREEN_WIDTH * SCREEN_HEIGHT / 10); static lv_disp_drv_t disp_drv; lv_disp_drv_init(&disp_drv); disp_drv.hor_res = SCREEN_WIDTH; disp_drv.ver_res = SCREEN_HEIGHT; disp_drv.flush_cb = my_disp_flush; disp_drv.draw_buf = &drawBuffer; lv_disp_drv_register(&disp_drv); static lv_indev_drv_t encoder_drv; lv_indev_drv_init(&encoder_drv); encoder_drv.type = LV_INDEV_TYPE_ENCODER; encoder_drv.read_cb = encoder_read; encoder_indev = lv_indev_drv_register(&encoder_drv); // Create a group and assign it to the encoder input device group = lv_group_create(); lv_indev_set_group(encoder_indev, group); // Create focusable widgets lv_obj_t *btn1 = lv_btn_create(lv_scr_act()); lv_obj_align(btn1, LV_ALIGN_CENTER, -60, 0); lv_obj_t *label1 = lv_label_create(btn1); lv_label_set_text(label1, "Button 1"); lv_obj_t *btn2 = lv_btn_create(lv_scr_act()); lv_obj_align(btn2, LV_ALIGN_CENTER, 60, 0); lv_obj_t *label2 = lv_label_create(btn2); lv_label_set_text(label2, "Button 2"); lv_obj_t *btn3 = lv_btn_create(lv_scr_act()); lv_obj_align(btn3, LV_ALIGN_CENTER, 0, 50); lv_obj_t *label3 = lv_label_create(btn3); lv_label_set_text(label3, "Button 3"); // Add widgets to the group lv_group_add_obj(group, btn1); lv_group_add_obj(group, btn2); lv_group_add_obj(group, btn3); }
-
RE: M5Dial TFT_eSPI pinout
@mukul_100_ Got this workking by using m5unified instead of tft_espi
But i can get the touch to work
as per what i read lvgl uses polling to get the touch coordinates using lv_timer_handler();but i dont understand how to implement M5Dial.Touch.getDetail(); to get the touch
-
RE: M5Dial TFT_eSPI pinout
@gordsh Hi ,
did you get this working ?
I am banging my head against the wall with this one right now ,
I am trying to use EEZ Studio with M5dial and using platform.io (or arduino ide whichever works)also if you have the file of user_setup.h for GC9A01. kindly share
Thank You -
how to implement gradient arcs/circles
Hi everyone, Im currently working on a UI for M5Dial and got this idea from the image attached for making four quadrants or arcs and then adding functionality.
i have got the functionality right but i dont understand how to get the fading effect or gradient effect on the arcs.im using platformIO right now
If anyone has inputs, kindly reply, Thanks. -
RE: ISO RS485 on M5dial
@felmue Hi, felix i got it working finally. The issue is, on platformIO the library Arduinomodbus library and ArduinoRS485 library are the arduino ones and not the m5stack ones which is why i was getting error.
A fix to this was to just replace the internal files of library to the m5stack ones from github.
Thank you for the help. -
RE: ISO RS485 on M5dial
@felmue ,did you make any changes in the RS485.h file
along these line 46
#else
#ifndef RS485_DEFAULT_DE_PIN
#define RS485_DEFAULT_DE_PIN A6
#define RS485_DEFAULT_RE_PIN A5
#endifthanks,
Mukul -
RE: ISO RS485 on M5dial
@felmue Hi felix
the changes you mentioned are in the same example code that is linked above? -
RE: ISO RS485 on M5dial
@felmue hi felix sorry for the late reply, finally got a chance to get back to this
i studied the example but not sure if i understood how to implement the master slave concept through this and also there is a error thrown in
RS485Class RS485(Serial2, GPIO_NUM_1, GPIO_NUM_2, -1, -1);as there are only 4 arguments accepted by the class
also serial2 needs some tweaking for esp32 right?
thanks