mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 23:17:35 -06:00
FIX: request pushall when mqtt message lost
Change-Id: I178c071f5920ce5a2c5872994ccd0563c01ae3a4
This commit is contained in:
parent
2f2c131599
commit
134c4a0815
1 changed files with 8 additions and 6 deletions
|
@ -2503,14 +2503,16 @@ int MachineObject::parse_json(std::string payload)
|
||||||
std::string str_seq = j_pre["print"]["sequence_id"].get<std::string>();
|
std::string str_seq = j_pre["print"]["sequence_id"].get<std::string>();
|
||||||
try {
|
try {
|
||||||
int sequence_id = stoi(str_seq);
|
int sequence_id = stoi(str_seq);
|
||||||
if (sequence_id != print_sequence_id + 1 && m_active_state >= SequenceValid) {
|
if (j_pre["print"]["msg"].get<int>() == 0) { // all message
|
||||||
wxLogWarning("parse_json: print_sequence_id gap, %d -> %d %s", print_sequence_id, sequence_id, wxString::FromUTF8(payload));
|
|
||||||
BOOST_LOG_TRIVIAL(warning) << "parse_json: print_sequence_id gap, " << print_sequence_id << " -> " << sequence_id;
|
|
||||||
if (sequence_id - print_sequence_id < 0 && sequence_id - print_sequence_id > -20)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
print_sequence_id = sequence_id;
|
|
||||||
if (m_active_state == SequenceNotValid) m_active_state = SequenceValid; // Have init print_sequence_id
|
if (m_active_state == SequenceNotValid) m_active_state = SequenceValid; // Have init print_sequence_id
|
||||||
|
print_sequence_id = sequence_id;
|
||||||
|
} else if (sequence_id != print_sequence_id + 1 && m_active_state >= SequenceValid) {
|
||||||
|
wxLogWarning("parse_json: print_sequence_id gap, %d -> %d %s", print_sequence_id, sequence_id, wxString::FromUTF8(payload));
|
||||||
|
if (m_active_state == SequenceValid) m_active_state = SequenceNotValid;
|
||||||
|
GUI::wxGetApp().CallAfter([this] { this->command_request_push_all(); });
|
||||||
|
} else if (m_active_state >= SequenceValid) {
|
||||||
|
print_sequence_id = sequence_id;
|
||||||
|
}
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue