| 930 | } |
| 931 | |
| 932 | void drawNumber(String &filename, int32_t count, int32_t thresholdred, tagRecord *&taginfo, imgParam &imageParams) { |
| 933 | int32_t countTemp = count; |
| 934 | count = abs(count); |
| 935 | if (taginfo->hwType == SOLUM_SEG_UK) { |
| 936 | imageParams.symbols = 0x00; |
| 937 | if (count > 19999) { |
| 938 | sprintf(imageParams.segments, "over flow"); |
| 939 | return; |
| 940 | } else if (count > 9999) { |
| 941 | imageParams.symbols = 0x02; |
| 942 | sprintf(imageParams.segments, "%04d", count - 10000); |
| 943 | } else { |
| 944 | sprintf(imageParams.segments, "%4d", count); |
| 945 | } |
| 946 | if (taginfo->contentMode == 3) { |
| 947 | strcat(imageParams.segments, " hour"); |
| 948 | } else { |
| 949 | strcat(imageParams.segments, " days"); |
| 950 | } |
| 951 | return; |
| 952 | } |
| 953 | |
| 954 | TFT_eSprite spr = TFT_eSprite(&tft); |
| 955 | |
| 956 | JsonDocument loc; |
| 957 | getTemplate(loc, 2, taginfo->hwType); |
| 958 | |
| 959 | initSprite(spr, imageParams.width, imageParams.height, imageParams); |
| 960 | uint16_t color = TFT_BLACK; |
| 961 | if (countTemp > thresholdred) { |
| 962 | color = imageParams.highlightColor; |
| 963 | } |
| 964 | String font = loc["fonts"][0].as<String>(); |
| 965 | uint8_t size = loc["fonts"][1].as<uint16_t>(); |
| 966 | if (count > 9) size = loc["fonts"][2].as<uint16_t>(); |
| 967 | if (count > 99) size = loc["fonts"][3].as<uint16_t>(); |
| 968 | if (count > 999) size = loc["fonts"][4].as<uint16_t>(); |
| 969 | if (count > 9999) size = loc["fonts"][5].as<uint16_t>(); |
| 970 | if (count > 99999) size = loc["fonts"][6].as<uint16_t>(); |
| 971 | drawString(spr, String(count), loc["xy"][0].as<uint16_t>(), loc["xy"][1].as<uint16_t>() - size / 1.8, font, TC_DATUM, color, size); |
| 972 | |
| 973 | spr2buffer(spr, filename, imageParams); |
| 974 | spr.deleteSprite(); |
| 975 | } |
| 976 | |
| 977 | /// @brief Get a weather icon |
| 978 | /// @param id Icon identifier/index |
no test coverage detected