BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

Segmented switch reselection issue

No, in the AppStore only 15.1 … in apkpure I find it but in xapk, do you have a link to apk?

yep, I forgot that you need to reselect the state again even in buttons. if all buttons are on same pin and in off state - there is no option to change specific button ui via set property.

15.2 would not help - segmented switch is not resending selected value

Yeh, this is the actual problem I have now with ver 15. and with multipe push buttons same Pin.

Regards

Any reason why you don’t want to switch to 20 virtual data streams for all buttons, except for its 20 data streams?

The first reason is the button minimum dimension make the UIvery ugly.
Second I must do a huge modification on the HW Code…

The Second is not a problem but UI yes, if we can do it to be similar to Segmented Switches …

Regards

@bek
code modification - yep.
on size: styled button have smaller min-width, so it should be possible to place 6 widgets in a row. icon button can be even smaller.

I will try and let you know …

Thanks for you help :slight_smile:

I have 67 Datastreams and cann’t use more 20 datastreams for 20 buttons maximum 80 for my plan, also the dimension of 5 switchies on same line is not possibile, I may have 4 same dimensions and 1 with smaller width or 6 same dimension but I need only 5 for each line.

Regards

Is it hard to change the approach in your code so that Segmented Switch actually does just changes the state of which camera is selected?

Sounds like whatever you do in BLYNK_WRITE attached to Segmented Switch now, you can move all it to a separate function, say apply(), and trigger that apply() by some dedicated Button widget.

(select action ↔ select camera) → apply

Do you mean something like a confirmation every time I change Camera, this will make the swithcing very slow beacuse in some situation we need just to click on the button to switch immediately to the selected camera.
The problem after the last update is that I use multiple Segmented Switches for the same function.
I really can’t find a solution except the Downgrade to VersioN 13 which is working perfect and the UI sends always the selected value to the HW even if it is not changed…
I hope this issue could be fixed to be able to have future updates…

Finally I fixed the issue in the code.
Each time the BLYNK_WRITE of any segment is received I do a Blynk.virtualWrite for all the others sending a non used value “6” and in each BLYNK_WRITE I ignore any value greater than 5.

BLYNK_WRITE(V3) // R_1_TO_5
{
    segmentedSwitch = 1;
    Blynk.virtualWrite(V16, 6);
    Blynk.virtualWrite(V17, 6);
    Blynk.virtualWrite(V18, 6);
    Blynk.virtualWrite(V25, 6);
    if ( param.asInt() != 6)
    {
    _blynkEvent = true;
    _blynkData=param.asInt();
    eventdata = Q_EVENT_ROOM_ID_1_TO_5_V3;
    Serial.println(_blynkData);
    xQueueSend(g_event_queue_handle, &eventdata, portMAX_DELAY);
    }
}


BLYNK_WRITE(V16) // R_6_TO_10
{
    segmentedSwitch = 2;
    Blynk.virtualWrite(V3, 6);
    Blynk.virtualWrite(V17, 6);
    Blynk.virtualWrite(V18, 6);
    Blynk.virtualWrite(V25, 6);
    if ( param.asInt() != 6)
    {
    _blynkEvent = true;
    _blynkData=param.asInt();
    eventdata = Q_EVENT_ROOM_ID_6_TO_10_V16;
    xQueueSend(g_event_queue_handle, &eventdata, portMAX_DELAY);
  } 
}


BLYNK_WRITE(V17) // R_11_TO_15
{
    segmentedSwitch = 3;
    Blynk.virtualWrite(V16, 6);
    Blynk.virtualWrite(V3, 6);
    Blynk.virtualWrite(V18, 6);
    Blynk.virtualWrite(V25, 6);
    if ( param.asInt() != 6)
    {  
    _blynkEvent = true;
    _blynkData=param.asInt();
    eventdata = Q_EVENT_ROOM_ID_11_TO_15_V17;
    xQueueSend(g_event_queue_handle, &eventdata, portMAX_DELAY);
    }
}

BLYNK_WRITE(V18) // R_16_TO_20
{
    segmentedSwitch = 4;
    Blynk.virtualWrite(V3, 6);
    Blynk.virtualWrite(V17, 6);
    Blynk.virtualWrite(V16, 6);
    Blynk.virtualWrite(V25, 6);
    if ( param.asInt() != 6)
    {  
    _blynkEvent = true;
    _blynkData=param.asInt();
    eventdata = Q_EVENT_ROOM_ID_16_TO_20_V18;
    xQueueSend(g_event_queue_handle, &eventdata, portMAX_DELAY);
    }
}

1 Like