В общем какая-то ерунда. Сейчас сделал отдельный проект и вынес в него только данный вопрос. И что заметил. В “некоторых” случаях работает, в некоторых нет.
Вариант 1 - Не работает:
проект во всех вариантах TestH.ino
Спойлер
Файл Test.ino
#include "first.h"
Файл first.h
struct TData {
bool isR;
int sw;
};
Файл Dev.ino (созданная вкладка в IDE)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
bool readdata (TData dd) {
}
Вариант 2 - Работает
Спойлер
Файл Test.ino
#include "first.h"
bool readdata (TData dd) {
}
Файл first.h
struct TData {
bool isR;
int sw;
};
Файл Dev.ino (созданная вкладка в IDE)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
И третий вариант тоже работает
Спойлер
Файл Test.ino
#include "first.h"
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Файл first.h
struct TData {
bool isR;
int sw;
};
Файл Dev.ino (созданная вкладка в IDE)
bool readdata (TData dd) {
}
Получается не работает только если Setup, Loop и readdata вынести в отдельную вкладку… Немного странно конечно.
Ошибка первого варианта:
Спойлер
E:\ELECTRONICS\MYPROJECT\MK\ARDUINO\SKETCHS!!!TMP!!!\TestH\Dev.ino:11:15: error: ‘TData’ was not declared in this scope
^
E:\ELECTRONICS\MYPROJECT\MK\ARDUINO\SKETCHS!!!TMP!!!\TestH\Dev.ino: In function ‘bool readdata(TData)’:
E:\ELECTRONICS\MYPROJECT\MK\ARDUINO\SKETCHS!!!TMP!!!\TestH\Dev.ino:11:24: error: ‘bool readdata(TData)’ redeclared as different kind of symbol
^
E:\ELECTRONICS\MYPROJECT\MK\ARDUINO\SKETCHS!!!TMP!!!\TestH\Dev.ino:11:6: note: previous declaration ‘bool readdata’
^
exit status 1
Compilation error: ‘TData’ was not declared in this scope