MCPcopy Create free account
hub / github.com/NSPManager/NSPanelManager / has_tft_update

Method has_tft_update

docker/MQTTManager/include/nspanel/nspanel.cpp:833–950  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

831}
832
833bool NSPanel::has_tft_update() {
834 // Check if using EU file (we use EU file for US panel in landscape left orientation as it's the same screen and orientation as the EU panel).
835 if (!this->_is_us_panel || (this->_is_us_panel && this->_us_panel_orientation == US_PANEL_ORIENTATION::LANDSCAPE_LEFT)) {
836 if (this->_get_nspanel_setting_with_default("selected_tft", "tft1").compare("tft1") == 0) {
837 auto file_checksum = MqttManagerConfig::get_eu_tft1_checksum();
838 if (file_checksum) {
839 return this->_current_tft_md5_checksum.compare(*file_checksum) != 0;
840 } else {
841 SPDLOG_ERROR("Checksum for selected TFT file does not exist!");
842 return false;
843 }
844 } else if (this->_get_nspanel_setting_with_default("selected_tft", "tft1").compare("tft2") == 0) {
845 auto file_checksum = MqttManagerConfig::get_eu_tft2_checksum();
846 if (file_checksum) {
847 return this->_current_tft_md5_checksum.compare(*file_checksum) != 0;
848 } else {
849 SPDLOG_ERROR("Checksum for selected TFT file does not exist!");
850 return false;
851 }
852 } else if (this->_get_nspanel_setting_with_default("selected_tft", "tft1").compare("tft3") == 0) {
853 auto file_checksum = MqttManagerConfig::get_eu_tft3_checksum();
854 if (file_checksum) {
855 return this->_current_tft_md5_checksum.compare(*file_checksum) != 0;
856 } else {
857 SPDLOG_ERROR("Checksum for selected TFT file does not exist!");
858 return false;
859 }
860 } else if (this->_get_nspanel_setting_with_default("selected_tft", "tft1").compare("tft4") == 0) {
861 auto file_checksum = MqttManagerConfig::get_eu_tft4_checksum();
862 if (file_checksum) {
863 return this->_current_tft_md5_checksum.compare(*file_checksum) != 0;
864 } else {
865 SPDLOG_ERROR("Checksum for selected TFT file does not exist!");
866 return false;
867 }
868 } else {
869 SPDLOG_ERROR("Could not determin selected TFT file when comparing checksums! Selected TFT for nspanel {}::{} is {}", this->_id, this->_name, this->_get_nspanel_setting_with_default("selected_tft", "tft1"));
870 return false;
871 }
872 } else if (this->_is_us_panel && this->_us_panel_orientation == US_PANEL_ORIENTATION::PORTRAIT) {
873 if (this->_get_nspanel_setting_with_default("selected_tft", "tft1").compare("tft1") == 0) {
874 auto file_checksum = MqttManagerConfig::get_us_tft1_checksum();
875 if (file_checksum) {
876 return this->_current_tft_md5_checksum.compare(*file_checksum) != 0;
877 } else {
878 SPDLOG_ERROR("Checksum for selected TFT file does not exist!");
879 return false;
880 }
881 } else if (this->_get_nspanel_setting_with_default("selected_tft", "tft1").compare("2222") == 0) {
882 auto file_checksum = MqttManagerConfig::get_us_tft2_checksum();
883 if (file_checksum) {
884 return this->_current_tft_md5_checksum.compare(*file_checksum) != 0;
885 } else {
886 SPDLOG_ERROR("Checksum for selected TFT file does not exist!");
887 return false;
888 }
889 }
890 if (this->_get_nspanel_setting_with_default("selected_tft", "tft1").compare("tft3") == 0) {

Callers 1

Tested by

no test coverage detected