Transforms the weather number into the string weather word.
letters-icon-to-word
@/letters-icon-to-word
Transforms the weather number into the string weather word.
ICONnumber
WORDstring
To use the node in your project you should have the gabbapeople/iot-split-flap-display library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.
C++ implementation
struct State {
CStringView word;
};
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
auto state = getState(ctx);
int icon = getValue<input_ICON>(ctx);
switch (icon) {
case 1: state->word = CStringView("SUN "); break;
case 2: state->word = CStringView("MSUN"); break;
case 3: state->word = CStringView("PSUN"); break;
case 4: state->word = CStringView("ICLO"); break;
case 5: state->word = CStringView("HSUN"); break;
case 6: state->word = CStringView("MCLO"); break;
case 7: state->word = CStringView("CLO "); break;
case 8: state->word = CStringView("DRE "); break;
case 11: state->word = CStringView("FOG "); break;
case 12: state->word = CStringView("SHOW"); break;
case 13: state->word = CStringView("MCLS"); break;
case 14: state->word = CStringView("PSUS"); break;
case 15: state->word = CStringView("TSTM"); break;
case 16: state->word = CStringView("MCLT"); break;
case 17: state->word = CStringView("PSUT"); break;
case 18: state->word = CStringView("RAIN"); break;
case 19: state->word = CStringView("FLUR"); break;
case 20: state->word = CStringView("MCLF"); break;
case 21: state->word = CStringView("PSUF"); break;
case 22: state->word = CStringView("SNOW"); break;
case 23: state->word = CStringView("MCLS"); break;
case 24: state->word = CStringView("ICE "); break;
case 25: state->word = CStringView("SLEE"); break;
case 26: state->word = CStringView("FRAI"); break;
case 29: state->word = CStringView("RASN"); break;
case 30: state->word = CStringView("HOT "); break;
case 31: state->word = CStringView("COLD"); break;
case 32: state->word = CStringView("WIND"); break;
case 33: state->word = CStringView("CLR "); break;
case 34: state->word = CStringView("MCLR"); break;
case 35: state->word = CStringView("PCL "); break;
case 36: state->word = CStringView("ICL "); break;
case 37: state->word = CStringView("HMOO"); break;
case 38: state->word = CStringView("MCL "); break;
case 39: state->word = CStringView("PCLS"); break;
case 40: state->word = CStringView("MCLS"); break;
case 41: state->word = CStringView("PCLT"); break;
case 42: state->word = CStringView("MCLT"); break;
case 43: state->word = CStringView("MCLF"); break;
case 44: state->word = CStringView("MCLS"); break;
default: break;
}
emitValue<output_WORD>(ctx,XString(&state->word));
}