Im am trying to populate an array in lambda.
For the simple case shown below I get a compile error. Normally this would be because of a type mismatch. Am I right in assuming a global of type array is not equivalent to a c++ array?
Global:
globals:
- type: float[20]
id: hist
Code:
// Store values in trends array
int index=1;
float value=3.2;
id(hist[index]) = value;
I get the following compile error:
/config/esphome/wind.yaml: In lambda function:
/config/esphome/wind.yaml:126:23: error: no match for 'operator=' (operand types are 'esphome::globals::GlobalsComponent<float [20]>' and 'float')
id(hist[index]) = value;
^
In file included from src/esphome.h:21:0,
from src/main.cpp:3:
src/esphome/components/globals/globals_component.h:11:28: note: candidate: esphome::globals::GlobalsComponent<float [20]>& esphome::globals::GlobalsComponent<float [20]>::operator=(const esphome::globals::GlobalsComponent<float [20]>&)
template<typename T> class GlobalsComponent : public Component {
^
src/esphome/components/globals/globals_component.h:11:28: note: no known conversion for argument 1 from 'float' to 'const esphome::globals::GlobalsComponent<float [20]>&'
src/esphome/components/globals/globals_component.h:11:28: note: candidate: esphome::globals::GlobalsComponent<float [20]>& esphome::globals::GlobalsComponent<float [20]>::operator=(esphome::globals::GlobalsComponent<float [20]>&&)
src/esphome/components/globals/globals_component.h:11:28: note: no known conversion for argument 1 from 'float' to 'esphome::globals::GlobalsComponent<float [20]>&&'
*** [/data/wind/.pioenvs/wind/src/main.cpp.o] Error 1
Any suggestions?