File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -120,8 +120,8 @@ namespace bambulabs
120120 }
121121 }
122122
123- if (doc_in[" color_hex" ].as <std::string>().length () != 6 ) {
124- ESP_LOGE (" bambu" , " Invalid color_hex length (expected 6 characters)" );
123+ if (doc_in[" color_hex" ].as <std::string>().length () != 6 && doc_in[ " color_hex " ]. as <std::string>(). length () != 8 ) {
124+ ESP_LOGE (" bambu" , " Invalid color_hex length (expected 6 or 8 characters)" );
125125 return {};
126126 }
127127
@@ -130,7 +130,12 @@ namespace bambulabs
130130 print[" command" ] = " ams_filament_setting" ;
131131 print[" ams_id" ] = ams_id;
132132 print[" tray_id" ] = ams_tray;
133- print[" tray_color" ] = doc_in[" color_hex" ].as <std::string>() + " FF" ;
133+ if (doc_in[" color_hex" ].as <std::string>().length () == 6 ) {
134+ print[" tray_color" ] = doc_in[" color_hex" ].as <std::string>() + " FF" ;
135+ }
136+ else {
137+ print[" tray_color" ] = doc_in[" color_hex" ].as <std::string>();
138+ }
134139 print[" nozzle_temp_min" ] = uint16_t (doc_in[" min_temp" ]); // if not string or int, will fall back to 0
135140 print[" nozzle_temp_max" ] = uint16_t (doc_in[" max_temp" ]); // if not string or int, will fall back to 0
136141 print[" tray_type" ] = doc_in[" type" ];
You can’t perform that action at this time.
0 commit comments