ENH:periodic request full push

when the printer does not push any data packets,
request data from the printer at intervals

Change-Id: I4c84586301588f6a14f65d7a732d22f57bce59c9
This commit is contained in:
tao wang 2023-07-07 15:52:33 +08:00 committed by Lane.Wei
parent 18a5575bbc
commit 7ffeb1a432
2 changed files with 7 additions and 2 deletions

View file

@ -4350,11 +4350,16 @@ void DeviceManager::keep_alive()
obj->keep_alive_count++; obj->keep_alive_count++;
std::chrono::system_clock::time_point start = std::chrono::system_clock::now(); std::chrono::system_clock::time_point start = std::chrono::system_clock::now();
auto internal = std::chrono::duration_cast<std::chrono::milliseconds>(start - obj->last_keep_alive); auto internal = std::chrono::duration_cast<std::chrono::milliseconds>(start - obj->last_keep_alive);
if (internal.count() > TIMEOUT_FOR_KEEPALIVE && internal.count() < 1000 * 60 * 60 * 300) { if (internal.count() > TIMEOUT_FOR_KEEPALIVE && (internal.count() < 1000 * 60 * 60 * 300) ) {
BOOST_LOG_TRIVIAL(info) << "keep alive = " << internal.count() << ", count = " << obj->keep_alive_count; BOOST_LOG_TRIVIAL(info) << "keep alive = " << internal.count() << ", count = " << obj->keep_alive_count;
obj->command_request_push_all(); obj->command_request_push_all();
obj->last_keep_alive = start; obj->last_keep_alive = start;
} }
else if(obj->m_push_count == 0){
BOOST_LOG_TRIVIAL(info) << "keep alive = " << internal.count() << ", push_count = 0, count = " << obj->keep_alive_count;
obj->command_request_push_all();
obj->last_keep_alive = start;
}
} }
} }

View file

@ -20,7 +20,7 @@
#define PUSHINFO_TIMEOUT 15000.f // milliseconds #define PUSHINFO_TIMEOUT 15000.f // milliseconds
#define TIMEOUT_FOR_STRAT 20000.f // milliseconds #define TIMEOUT_FOR_STRAT 20000.f // milliseconds
#define TIMEOUT_FOR_KEEPALIVE 5* 60 * 1000.f // milliseconds #define TIMEOUT_FOR_KEEPALIVE 5* 60 * 1000.f // milliseconds
#define REQUEST_PUSH_MIN_TIME 15000.f // milliseconds #define REQUEST_PUSH_MIN_TIME 3000.f // milliseconds
#define REQUEST_START_MIN_TIME 15000.f // milliseconds #define REQUEST_START_MIN_TIME 15000.f // milliseconds
#define EXTRUSION_OMIT_TIME 20000.f // milliseconds #define EXTRUSION_OMIT_TIME 20000.f // milliseconds
#define HOLD_TIMEOUT 10000.f // milliseconds #define HOLD_TIMEOUT 10000.f // milliseconds