mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-27 21:02:23 +00:00
feature add bury point for slice model and use soft, login soft.
This commit is contained in:
@@ -6296,11 +6296,11 @@ extern "C" {
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
initSentry();
|
||||
std::string softStartTime = BP_SOFT_START_TIME+ ":" + get_timestamp_seconds();
|
||||
sentryReportLog(SENTRY_LOG_TRACE, softStartTime, BP_START_SOFT);
|
||||
auto soft_start_time = get_time_timestamp();
|
||||
auto res = CLI().run(argc, argv);
|
||||
auto soft_end_time = get_time_timestamp();
|
||||
|
||||
std::string softEndTime = BP_SOFT_END_TIME + ":" + get_timestamp_seconds();
|
||||
std::string softEndTime = BP_SOFT_WORKS_TIME + std::string(":") + get_works_time(soft_end_time - soft_start_time);
|
||||
sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT);
|
||||
exitSentry();
|
||||
|
||||
|
||||
@@ -227,8 +227,7 @@ int wmain(int argc, wchar_t** argv)
|
||||
_set_error_mode(_OUT_TO_MSGBOX);
|
||||
|
||||
initSentry();
|
||||
std::string softStartTime = BP_SOFT_START_TIME + std::string(":") + get_timestamp_seconds();
|
||||
sentryReportLog(SENTRY_LOG_TRACE, softStartTime, BP_START_SOFT);
|
||||
auto soft_start_time = get_time_timestamp();
|
||||
|
||||
std::vector<wchar_t*> argv_extended;
|
||||
argv_extended.emplace_back(argv[0]);
|
||||
@@ -294,7 +293,9 @@ int wmain(int argc, wchar_t** argv)
|
||||
HINSTANCE hInstance_Slic3r = LoadLibraryExW(path_to_slic3r, nullptr, 0);
|
||||
if (hInstance_Slic3r == nullptr) {
|
||||
printf("Snapmaker_Orca.dll was not loaded, error=%d\n", GetLastError());
|
||||
std::string softEndTime = BP_SOFT_END_TIME + std::string(":") + get_timestamp_seconds();
|
||||
|
||||
auto soft_end_time = get_time_timestamp();
|
||||
std::string softEndTime = BP_SOFT_WORKS_TIME + std::string(":") + get_works_time(soft_end_time - soft_start_time);
|
||||
sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT);
|
||||
exitSentry();
|
||||
return -1;
|
||||
@@ -312,7 +313,8 @@ int wmain(int argc, wchar_t** argv)
|
||||
);
|
||||
if (Snapmaker_Orca_main == nullptr) {
|
||||
printf("could not locate the function Snapmaker_Orca_main in Snapmaker_Orca.dll\n");
|
||||
std::string softEndTime = BP_SOFT_END_TIME + std::string(":") + get_timestamp_seconds();
|
||||
auto soft_end_time = get_time_timestamp();
|
||||
std::string softEndTime = BP_SOFT_WORKS_TIME + std::string(":") + get_works_time(soft_end_time - soft_start_time);
|
||||
sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT);
|
||||
exitSentry();
|
||||
return -1;
|
||||
@@ -320,7 +322,8 @@ int wmain(int argc, wchar_t** argv)
|
||||
|
||||
// argc minus the trailing nullptr of the argv
|
||||
auto res = Snapmaker_Orca_main((int) argv_extended.size() - 1, argv_extended.data());
|
||||
std::string softEndTime = BP_SOFT_END_TIME + std::string(":") + get_timestamp_seconds();
|
||||
auto soft_end_time = get_time_timestamp();
|
||||
std::string softEndTime = BP_SOFT_WORKS_TIME + std::string(":") + get_works_time(soft_end_time - soft_start_time);
|
||||
sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT);
|
||||
exitSentry();
|
||||
return res;
|
||||
|
||||
@@ -15,4 +15,33 @@ std::string get_timestamp_seconds()
|
||||
auto strTime = oss.str();
|
||||
|
||||
return strTime;
|
||||
}
|
||||
|
||||
long long get_time_timestamp()
|
||||
{
|
||||
auto now = std::chrono::system_clock::now();
|
||||
|
||||
auto timestamp = std::chrono::duration_cast<std::chrono::seconds>(now.time_since_epoch()).count();
|
||||
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
std::string get_works_time(const uint64_t& timestamp)
|
||||
{
|
||||
uint64_t hours = timestamp / 3600000;
|
||||
uint64_t remaining_ms = timestamp % 3600000;
|
||||
|
||||
uint64_t minutes = remaining_ms / 60000;
|
||||
remaining_ms = remaining_ms % 60000;
|
||||
|
||||
uint64_t seconds = remaining_ms / 1000;
|
||||
uint64_t ms = remaining_ms % 1000;
|
||||
|
||||
char buffer[32] = {0};
|
||||
std::snprintf(buffer, sizeof(buffer), "%02llu:%02llu:%02llu.%03llu", hours, minutes, seconds, ms);
|
||||
|
||||
|
||||
std::string works_time = std::string(buffer);
|
||||
|
||||
return works_time;
|
||||
}
|
||||
@@ -3,9 +3,10 @@
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#define BURY_POINT "bury_point"
|
||||
|
||||
#define BP_START_SOFT "bury_point_start_soft"
|
||||
#define BP_SOFT_START_TIME "soft_start_time"
|
||||
#define BP_SOFT_END_TIME "soft_end_time"
|
||||
#define BP_SOFT_WORKS_TIME "soft_works_time"
|
||||
|
||||
#define BP_DEIVCE_CONNECT "bury_point_device_connect"
|
||||
#define BP_CONNECT_DEVICE_ID "device_id"
|
||||
@@ -28,12 +29,17 @@
|
||||
#define BP_COLOR_PAINTING "bury_point_color_painting"
|
||||
|
||||
#define BP_VIDEO_ABNORMAL "bury_point_video_abnormal"
|
||||
|
||||
#define BP_SLICE_DURATION "bury_point_slice_duration"
|
||||
#define BP_SLICE_DURATION_TIME "slice_duration_time"
|
||||
|
||||
//webview bury point
|
||||
|
||||
|
||||
|
||||
static bool isAgreeSlice = false;
|
||||
extern std::string get_timestamp_seconds();
|
||||
|
||||
extern long long get_time_timestamp();
|
||||
extern std::string get_works_time(const uint64_t& timestamp);
|
||||
|
||||
#endif
|
||||
@@ -57,14 +57,15 @@ static sentry_value_t on_crash_callback(const sentry_ucontext_t* uctx, sentry_va
|
||||
static sentry_value_t before_send(sentry_value_t event, void* hint, void* data)
|
||||
{
|
||||
sentry_value_t level_val = sentry_value_get_by_key(event, SENTRY_KEY_LEVEL);
|
||||
std::string levelName = sentry_value_as_string(level_val);
|
||||
|
||||
std::string eventLevel = sentry_value_as_string(sentry_value_get_by_key(event, SENTRY_KEY_LEVEL));
|
||||
|
||||
//module name
|
||||
sentry_value_t logger_val = sentry_value_get_by_key(event, "logger");
|
||||
std::string logger = sentry_value_as_string(logger_val);
|
||||
sentry_value_t moduleValue = sentry_value_get_by_key(event, "logger");
|
||||
std::string moduleName = sentry_value_as_string(moduleValue);
|
||||
|
||||
if (MACHINE_MODULE == logger)
|
||||
if (MACHINE_MODULE == moduleName)
|
||||
{
|
||||
srand((unsigned int) time(0));
|
||||
int random_num = rand() % 100;
|
||||
@@ -255,6 +256,8 @@ void sentryReportLogEx(SENTRY_LOG_LEVEL logLevel,
|
||||
sentry_value_set_by_key(tags, "snapmaker_trace_id", sentry_value_new_string(logTraceId.c_str()));
|
||||
}
|
||||
|
||||
if (SENTRY_LEVEL_TRACE == sentry_msg_level)
|
||||
sentry_set_tag(BURY_POINT, "snapmaker_bury_point");
|
||||
|
||||
if (!logTagKey.empty())
|
||||
sentry_set_tag(logTagKey.c_str(), logTagValue.c_str());
|
||||
|
||||
@@ -352,7 +352,7 @@ bool GLGizmosManager::open_gizmo(EType type)
|
||||
m_parent.post_event(SimpleEvent(wxEVT_PAINT));
|
||||
#endif
|
||||
if (EType::MmSegmentation == type)
|
||||
sentryReportLog(SENTRY_LOG_TRACE, "", BP_COLOR_PAINTING);
|
||||
sentryReportLog(SENTRY_LOG_TRACE, BP_COLOR_PAINTING, BP_COLOR_PAINTING);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -156,6 +156,9 @@
|
||||
#include "CloneDialog.hpp"
|
||||
#include "WebPreprintDialog.hpp"
|
||||
|
||||
#include "sentry_wrapper/sentryWrapper.hpp"
|
||||
#include <chrono>
|
||||
|
||||
using boost::optional;
|
||||
namespace fs = boost::filesystem;
|
||||
using Slic3r::_3DScene;
|
||||
@@ -3089,6 +3092,9 @@ struct Plater::priv
|
||||
bool show_wireframe{ false };
|
||||
bool wireframe_enabled{ true };
|
||||
|
||||
std::chrono::steady_clock::time_point m_slice_start_time;
|
||||
bool m_slice_timing_active = false;
|
||||
|
||||
static const std::regex pattern_bundle;
|
||||
static const std::regex pattern_3mf;
|
||||
static const std::regex pattern_zip_amf;
|
||||
@@ -7649,6 +7655,9 @@ void Plater::priv::on_export_finished(wxCommandEvent& evt)
|
||||
|
||||
void Plater::priv::on_slicing_began()
|
||||
{
|
||||
if(!m_slice_timing_active)
|
||||
m_slice_start_time = std::chrono::steady_clock::now();
|
||||
m_slice_timing_active = true;
|
||||
clear_warnings();
|
||||
notification_manager->close_notification_of_type(NotificationType::SignDetected);
|
||||
notification_manager->close_notification_of_type(NotificationType::ExportFinished);
|
||||
@@ -7733,6 +7742,31 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt)
|
||||
//BBS: add project slice logic
|
||||
bool is_finished = !m_slice_all || (m_cur_slice_plate == (partplate_list.get_plate_count() - 1));
|
||||
|
||||
{
|
||||
if (m_slice_timing_active) {
|
||||
auto end_time = std::chrono::steady_clock::now();
|
||||
auto duration_ms = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - m_slice_start_time).count();
|
||||
uint64_t timess = duration_ms;
|
||||
if (evt.cancelled()) {
|
||||
BOOST_LOG_TRIVIAL(info) << "Slicing cancelled after " << duration_ms << " ms";
|
||||
m_slice_start_time = {};
|
||||
m_slice_timing_active = false;
|
||||
} else if (evt.error())
|
||||
{
|
||||
m_slice_start_time = {};
|
||||
m_slice_timing_active = false;
|
||||
}
|
||||
else if (is_finished && evt.finished())
|
||||
{
|
||||
auto strTime = get_works_time(duration_ms);
|
||||
auto slice_time = BP_SLICE_DURATION_TIME + std::string(":") + strTime;
|
||||
sentryReportLog(SENTRY_LOG_TRACE, slice_time, BP_SLICE_DURATION);
|
||||
|
||||
m_slice_start_time = {};
|
||||
m_slice_timing_active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
//BBS: slice .gcode.3mf file related logic, assign is_finished again
|
||||
bool only_has_gcode_need_preview = false;
|
||||
auto plate_list = this->partplate_list.get_plate_list();
|
||||
@@ -7751,6 +7785,13 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt)
|
||||
// At this point of time the thread should be either finished or canceled,
|
||||
// so the following call just confirms, that the produced data were consumed.
|
||||
this->background_process.stop();
|
||||
if (m_slice_timing_active && !this->background_process.running())
|
||||
{
|
||||
if (evt.cancelled() || evt.error()) {
|
||||
m_slice_start_time = {};
|
||||
m_slice_timing_active = false;
|
||||
}
|
||||
}
|
||||
notification_manager->set_slicing_progress_export_possible();
|
||||
|
||||
// Reset the "export G-code path" name, so that the automatic background processing will be enabled again.
|
||||
|
||||
@@ -153,7 +153,7 @@ void PrintHostSendDialog::init()
|
||||
|
||||
auto* btn_ok = add_button(wxID_OK, true, _L("Upload"));
|
||||
btn_ok->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) {
|
||||
sentryReportLog(SENTRY_LOG_TRACE, "", BP_UPLOAD);
|
||||
sentryReportLog(SENTRY_LOG_TRACE, BP_UPLOAD, BP_UPLOAD);
|
||||
if (validate_path(txt_filename->GetValue())) {
|
||||
post_upload_action = PrintHostPostUploadAction::None;
|
||||
EndDialog(wxID_OK);
|
||||
@@ -174,7 +174,7 @@ void PrintHostSendDialog::init()
|
||||
if (post_actions.has(PrintHostPostUploadAction::StartPrint)) {
|
||||
auto* btn_print = add_button(wxID_YES, false, _L("Upload and Print"));
|
||||
btn_print->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) {
|
||||
sentryReportLog(SENTRY_LOG_TRACE, "", BP_UPLOAD_AND_PRINT);
|
||||
sentryReportLog(SENTRY_LOG_TRACE, BP_UPLOAD_AND_PRINT, BP_UPLOAD_AND_PRINT);
|
||||
if (validate_path(txt_filename->GetValue())) {
|
||||
post_upload_action = PrintHostPostUploadAction::StartPrint;
|
||||
EndDialog(wxID_OK);
|
||||
|
||||
Reference in New Issue
Block a user