CrealityPrint: add printer model name and detection UI

Add model_name() to map firmware model codes (F008, F012, F021)
to human-readable names (K2 Plus, K2 Pro, K2). Update the send
dialog init() to detect multi-color support and show a group box
with the printer name.

Signed-off-by: Igor Mammedov <niallain@gmail.com>
This commit is contained in:
Igor Mammedov
2026-04-23 00:48:44 +02:00
parent 7dd2e5c6a5
commit 02c71fa6c0
3 changed files with 36 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
#include "CrealityPrint.hpp"
#include <algorithm>
#include <map>
#include <sstream>
#include <exception>
#include <boost/format.hpp>
@@ -262,6 +263,20 @@ bool CrealityPrint::supports_multi_color_print() const
|| m_model == "F021"; // K2
}
std::string CrealityPrint::model_name() const
{
static const std::map<std::string, std::string> names = {
{"F008", "K2 Plus"},
{"F012", "K2 Pro"},
{"F021", "K2"},
};
query_model();
if (m_model.empty())
return "unreachable";
auto it = names.find(m_model);
return it != names.end() ? it->second : "unknown (" + m_model + ")";
}
std::string CrealityPrint::query_boxes_info() const
{
try {

View File

@@ -32,6 +32,7 @@ public:
bool upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn, InfoFn info_fn) const override;
bool supports_multi_color_print() const;
std::string query_boxes_info() const;
std::string model_name() const;
protected:
virtual void set_auth(Http& http) const;