FIX:fixed obtaining incorrect bits

jira:[none]

Change-Id: I27a4ae24870276912b69fad1c0285889e749030b
(cherry picked from commit 207d81c76933c5cf2fe2d28ed70ab2d246af2615)
This commit is contained in:
tao wang
2024-12-24 16:18:31 +08:00
committed by Noisyfox
parent 1556523ca1
commit 8a7fa6918d

View File

@@ -4024,12 +4024,12 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
/*ams info*/ /*ams info*/
if (it->contains("info")) { if (it->contains("info")) {
std::string info = (*it)["info"].get<std::string>(); std::string info = (*it)["info"].get<std::string>();
type_id = get_flag_bits(info, 0, 3); type_id = get_flag_bits(info, 0, 4);
nozzle_id = get_flag_bits(info, 8, 3); nozzle_id = get_flag_bits(info, 8, 4);
} }
/*AMS without initialization*/ /*AMS without initialization*/
if (nozzle_id == 0x0E) { if (nozzle_id == 0xE) {
continue; continue;
} }
@@ -5355,11 +5355,10 @@ void MachineObject::parse_new_info(json print)
upgrade_force_upgrade = get_flag_bits(cfg, 2); upgrade_force_upgrade = get_flag_bits(cfg, 2);
camera_recording_when_printing = get_flag_bits(cfg, 3); camera_recording_when_printing = get_flag_bits(cfg, 3);
camera_resolution = get_flag_bits(cfg, 4) == 0 ? "720p" : "1080p"; camera_resolution = get_flag_bits(cfg, 4) == 0 ? "720p" : "1080p";
//liveview_local = get_flag_bits(cfg, 5); todo zhanma camera_timelapse = get_flag_bits(cfg, 5);
camera_timelapse = get_flag_bits(cfg, 6); tutk_state = get_flag_bits(cfg, 6) == 1 ? "disable" : "";
tutk_state = get_flag_bits(cfg, 7) == 1 ? "disable" : ""; chamber_light = get_flag_bits(cfg, 7) == 1 ? LIGHT_EFFECT::LIGHT_EFFECT_ON : LIGHT_EFFECT::LIGHT_EFFECT_OFF;
chamber_light = get_flag_bits(cfg, 8) == 1 ? LIGHT_EFFECT::LIGHT_EFFECT_ON : LIGHT_EFFECT::LIGHT_EFFECT_OFF; printing_speed_lvl = (PrintingSpeedLevel)get_flag_bits(cfg, 8, 3);
printing_speed_lvl = (PrintingSpeedLevel)get_flag_bits(cfg, 9, 3);
//is_support_build_plate_marker_detect = get_flag_bits(cfg, 12); todo yangcong //is_support_build_plate_marker_detect = get_flag_bits(cfg, 12); todo yangcong
xcam_first_layer_inspector = get_flag_bits(cfg, 13); xcam_first_layer_inspector = get_flag_bits(cfg, 13);
@@ -5416,7 +5415,6 @@ void MachineObject::parse_new_info(json print)
BOOST_LOG_TRIVIAL(info) << "new print data aux = " << aux; BOOST_LOG_TRIVIAL(info) << "new print data aux = " << aux;
if (!aux.empty()) { if (!aux.empty()) {
//ams_exist_bits = get_flag_bits(aux, 8, 3); //todo yangcong
sdcard_state = MachineObject::SdcardState(get_flag_bits(aux, 12, 2)); sdcard_state = MachineObject::SdcardState(get_flag_bits(aux, 12, 2));
} }
@@ -5426,7 +5424,6 @@ void MachineObject::parse_new_info(json print)
BOOST_LOG_TRIVIAL(info) << "new print data stat = " << stat; BOOST_LOG_TRIVIAL(info) << "new print data stat = " << stat;
if (!stat.empty()) { if (!stat.empty()) {
//sdcard_state = get_flag_bits(aux, 12, 2); todo yangcong
camera_recording = get_flag_bits(stat, 7); camera_recording = get_flag_bits(stat, 7);
} }
@@ -5439,13 +5436,13 @@ void MachineObject::parse_new_info(json print)
} }
if (device.contains("bed_temp")) { if (device.contains("bed_temp")) {
bed_temp = get_flag_bits(device["bed_temp"].get<int>(), 0, 15); bed_temp = get_flag_bits(device["bed_temp"].get<int>(), 0, 16);
bed_temp_target = get_flag_bits(device["bed_temp"].get<int>(), 16, 15); bed_temp_target = get_flag_bits(device["bed_temp"].get<int>(), 16, 16);
} }
if (device.contains("cham_temp")) { if (device.contains("cham_temp")) {
chamber_temp = get_flag_bits(device["cham_temp"].get<int>(), 0, 15); chamber_temp = get_flag_bits(device["cham_temp"].get<int>(), 0, 16);
chamber_temp_target = get_flag_bits(device["cham_temp"].get<int>(), 16, 15); chamber_temp_target = get_flag_bits(device["cham_temp"].get<int>(), 16, 16);
} }
if (device.contains("fan")) { if (device.contains("fan")) {