Bridge issues

Вітання всім.
Стався напевно якийсь глюк.
В мене є проект, з трьох пристроїв і він працював до глюку просто чудово.
В проекті три пристрої:

  1. сенсор води 2-ва датчики температури;
  2. сенсор повітря датчик температури і вологості;
  3. TFT Display куди дані з датчиків передаються з пристрою 1 і 2;

В проект на смартфоні (Android 5.1) додано віджет Bridge.
Сервер blynk-cloud.com.
В пристрої-1 і 2 для передачі даних на пристрій-3 доданий такий код:


Greetings to everyone.
Certainly there was a glitch.
I have a project with three devices and it worked until glitch just fine.
There are three devices in the project:

  1. water sensor 2-way temperature sensors;
  2. sensor air temperature sensor and humidity;
  3. TFT Display where data from sensors is transmitted from devices 1 and 2;

The Bridge widget has been added to the project on Android 5.1.
Blynk-cloud.com server.
** In device-1 and 2 ** for transmitting data to ** device-3 ** the following code is added:

#define BRIDGE V3

WidgetBridge bridge1(BRIDGE);

BLYNK_CONNECTED()
{
	bridge1.setAuthToken("token_TFT"); // Token of the hardware monitorTFT
}

void timerSendServer()
{
	if (Blynk.connected())
	{
		// з пристрою-1 відсилаємо на пристрій-3 данні по V0
		bridge1.virtualWrite(V0, sensors.getTempCByIndex(0), sensors.getTempCByIndex(1));
		// а з 2 на 3 по V1
		// bridge1.virtualWrite(V1, dht.readTemperature(), dht.readHumidity());
	}
}

В пристрій 3 доданий такий код:


Device 3 has the following code added:

#define SENSOR_TT V0
#define SENSOR_TH V1

BLYNK_WRITE(SENSOR_TH)
{	
	tmpAir = param[0].asFloat();
	humAir = param[1].asFloat();
}

BLYNK_WRITE(SENSOR_TT)
{
	tmpWater1 = param[0].asFloat();
	tmpWater2 = param[1].asFloat();
}

В додатку на смартфоні пристрій-3 був просто доданий і отримано token. Віртуальні шпильки V0 і V1 для пристрою-3 ніяким чином не оголошені в додатку на смартфоні. На V2 назначений віджет LCD. Це все працювало просто чудово до моменту коли на пристрій-3 в додатку я назначив віджет LED і назначив йому шпильку V3. Шпильки V0, V1 і V2 були зайняті.
З цього моменту я не отримую данні з з пристроїв-1 і 2 на пристрій-3. Хоча пристрої-1 і 2 дані надсилають і їх видно в додатку на смартфоні.
Віджет LED я видалив з проекту. Дані так і не отримую на пристрій-3
Але коли я додаю у проект на смартфоні два віджета VALUE для пристрою 3 і назначаю їх на шпильки V0 і V1 данні чудово передаються на пристрій-3. Вже, я так розумію, через віджети VALUE а не BRIDGE?
Мені не потрібно дублювати данні в проекті на смартфоні, я хочу щоб працювало як раніше. Допоможіть будь ласка. Що можна зробити? Я в розпачі.


In the application on the smartphone ** the device-3 ** has just been added and received a token. The virtual studs V0 and V1 for the ** device-3 ** are not in any way announced in the application on the smartphone. On the V2 appointment is an LCD widget. It all worked just fine until the ** device-3 ** in the app I assigned the LED widget and assigned it a V3 pin. Studs V0, V1 and V2 were busy.
From now on, I do not get data from ** devices-1 and 2 ** on ** device-3 **. Although ** devices-1 and 2 ** send data and they can be seen in the application on the smartphone.
I removed the LED widget from the project. Data is not received by ** device-3 **
But when I add two VALUE widgets to the device on the smartphone on device 3 and assign them to the studs V0 and V1, the data is well transmitted to the ** device-3 **. Already, I understand this because of widgets VALUE and not BRIDGE?
I do not need to duplicate the data in the project on a smartphone, I want to work as before. Help please. What can I do? I’m in despair.

Please use English (or Google Translate) as this is a predominantly English forum, thank you.

Instead of nesting in this void timerSendServer(), have your Bridge command in it’s own function like this

BLYNK_CONNECTED() {
  bridge1.virtualWrite(V0, sensors.getTempCByIndex(0), sensors.getTempCByIndex(1)); // use the vPin of the receiving device/App
}

Also…

It is not clear in your snippets of code, but unless these variables are globally defined (I guess they are but hard to confirm), they may not work outside of their functions… and you are not doing anything with them while within in their functions (i.e. sending the data to a widget).

Try like this…

BLYNK_WRITE(ENSOR_TH) {
  Blynk.virtualWrite(tmpAir, param[0].asFloat());
  Blynk.virtualWrite(humAir, param[1].asFloat());
}

// and so on...

Thank you for attention.
In fact, data from devices 1 and 2 arrives at device 3.
For some reason, the display of information on the TFT display ceased to work.
I’m dealing with the problem.

Guys, that’s not something.
When I remove from the cycle “loop” the line “Blynk.run ();” then my TFT display is working fine.
Once the line “Blynk.run ();” It works, though by timer, even in an endless cycle, it’s all. The display stops working.
Display Illi9341 is connected to the SPI:
// Display SDO / MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
// Display LED to NodeMCU pin VIN (or 5V, see below)
// Display SCK to NodeMCU pin D5
// Display SDI / MOSI to NodeMCU pin D7
// Display DC (or AO) to NodeMCU pin D3
// Display RESET to NodeMCU pin D4 (or RST, see below)
// Display CS to NodeMCU pin D8 (or GND, see below)
// Display GND to NodeMCU Pin GND (0V)
// Display VCC to NodeMCU 5V or 3.3V

How can this be? What shall I do?

I recommend you start with a single board, a very simple Blynk sketch and your TFT display… load only those required libraries and try to get some simple displayed data onto both a display widget and your TFT.

If it still doesn’t work, then this will be much easier to troubleshoot then a three way bridged setup.

В мене все працювало добре, до того, що описано на початку. Щось сталось і я не можу поки знайти що.

Everything worked for me well before what was described in the beginning. Something has happened and I can not find anything yet.

Well, your initial posts was a bit convoluted… so you are saying EVERYTHING worked… all three boards, sharing via bridge and displaying whatever needed to be to the TFT display?

Все так. І щойно проблему знайшов. Зараз опишу в наступному коментарі.

All right. And just found the problem. I will now describe in the following comments.

Проблему знайдено зовсім в неочікуваному місці.
Допомогло те що я в попередньому коментарі опублікував розпіновку підключення мого TFT дисплею.
Але все по черзі.
В проекті маю три пристрої.
Два пристрої схематично однакові. Збирають показники вологості і температури.
Інший, третій пристрій, схематично відрізняється і має тільки TFT дисплей щоб відображати показники, зняті першими двома пристроями.
Все це працювало належним чином.
Я почав експериментувати з віджетом “Device Selector”.
На перших двох пристроях до GPIO13 (D7) під’єднані світлодіоди. І я у проект додав кнопку і назначив її на GPIO13 (D7) і обираючи віджетом “Device Selector” пристрій, кнопкою міг блимати на обраному пристрою світлодіодом.
Але ж на третьому пристрої на GPIO13 (D7) під’єднаний “SDI/MOCI” дисплею.
Ось одного разу я помилково обрав пристрій з дисплеєм і натискав кнопку GPIO13.
І тепер, коли третій пристрій підключався до серверу Blynk і все синхронізувалось командою Blynk.syncAll();, то D7 знаходився у статичному стані 0 або 1. Дані до дисплею не надходили.
Як “відв’язати” D7 від серверу, щоб при Blynk.syncAll(); не сінхронізувався D7, я не знаю. Тому видалив з проекту третій пристрій з дисплеєм і створив його знову.
Все запрацювало як слід.

Тепер в мене виникли такі питання. Що порадите, щоб надалі звести до мінімуму повторення такої ситуації?

  1. Використовувати в додатку виключно віртуальні піни?
  2. В віджеті “Device Selector” використовувати виключно теги?
  3. Не використовувати Blynk.syncAll(); а тільки конкретні (потрібні) пін?
  4. Ваш пропозиції?

The problem was found completely in an unexpected place.
It helped what I wrote in the previous commentary on the connection of my TFT display.
But all in turn.
I have three devices in the project.
The two devices are schematically identical. Collect moisture and temperature indices.
The other, third device is schematically different and has only a TFT display to display the scores captured by the first two devices.
All this worked properly.
I started experimenting with the “Device Selector” widget.
On the first two devices, LEDs are connected to the GPIO13 (D7). And I added the button to the project and assigned it to GPIO13 (D7) and selecting the Device Selector device widget, the button could blink on the selected device with a light emitting diode.
But on the third device on GPIO13 (D7) is connected the “SDI / MOCI” display.
Here once, I mistakenly chose the device with the display and pressed the GPIO13 button.
And now, when the third device was connected to the Blynk server and everything was synchronized with the command Blynk.syncAll () ;, the D7 was in a static state of 0 or 1. The data did not appear to the display.
How to “unlink” D7 from the server so that when Blynk.syncAll (); not synchronized with D7, I do not know. Therefore, I removed the third device with a display from the project and created it again.
Everything worked as it should.

Now I have such questions. What would you recommend to further minimize the repetition of this situation?

  1. Use only virtual pin’s in the application?
  2. In the “Device Selector” widget, use only tags?
  3. Do not use Blynk.syncAll (); but only concrete (necessary) pin’s?
  4. Your suggestions?