Browse Source

Merge remote-tracking branch 'remotes/prusa/et_custom_bed'

sorry, forgot to commit it before doing changes.
so there are also the bug fix for #76 and #74
supermerill 5 years ago
parent
commit
6b20a930eb

+ 5 - 4
deps/CMakeLists.txt

@@ -36,10 +36,11 @@ set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination direct
 option(DEP_DEBUG "Build debug variants (only applicable on Windows)" ON)
 option(DEP_WX_STABLE "Build against wxWidgets stable 3.0 as opposed to default 3.1 (Linux only)" OFF)
 
-# IGL static library in release mode produces 50MB binary. On the build server, it should be
-# disabled and used in header-only mode. On developer machines, it can be enabled to speed
-# up conpilation and suppress warnings coming from IGL. 
-option(DEP_BUILD_IGL_STATIC "Build IGL as a static library. Might cause link errors and increase binary size." OFF)
+# On developer machines, it can be enabled to speed up compilation and suppress warnings coming from IGL. 
+# FIXME:
+# Enabling this option is not safe. IGL will compile itself with its own version of Eigen while
+# Slic3r compiles with a different version which will cause runtime errors.
+# option(DEP_BUILD_IGL_STATIC "Build IGL as a static library. Might cause link errors and increase binary size." OFF)
 
 message(STATUS "Slic3r deps DESTDIR: ${DESTDIR}")
 message(STATUS "Slic3r deps debug build: ${DEP_DEBUG}")

+ 1 - 1
deps/deps-unix-common.cmake

@@ -54,7 +54,7 @@ ExternalProject_Add(dep_libigl
         -DLIBIGL_BUILD_PYTHON=OFF
         -DLIBIGL_BUILD_TESTS=OFF
         -DLIBIGL_BUILD_TUTORIALS=OFF
-        -DLIBIGL_USE_STATIC_LIBRARY=${DEP_BUILD_IGL_STATIC}
+        -DLIBIGL_USE_STATIC_LIBRARY=OFF #${DEP_BUILD_IGL_STATIC}
         -DLIBIGL_WITHOUT_COPYLEFT=OFF
         -DLIBIGL_WITH_CGAL=OFF
         -DLIBIGL_WITH_COMISO=OFF

+ 1 - 1
deps/deps-windows.cmake

@@ -273,7 +273,7 @@ ExternalProject_Add(dep_libigl
         -DLIBIGL_BUILD_PYTHON=OFF
         -DLIBIGL_BUILD_TESTS=OFF
         -DLIBIGL_BUILD_TUTORIALS=OFF
-        -DLIBIGL_USE_STATIC_LIBRARY=${DEP_BUILD_IGL_STATIC}
+        -DLIBIGL_USE_STATIC_LIBRARY=OFF #${DEP_BUILD_IGL_STATIC}
         -DLIBIGL_WITHOUT_COPYLEFT=OFF
         -DLIBIGL_WITH_CGAL=OFF
         -DLIBIGL_WITH_COMISO=OFF

+ 1 - 1
src/PrusaSlicer.cpp

@@ -579,7 +579,7 @@ void CLI::print_help(bool include_print_options, PrinterTechnology printer_techn
 #endif /* SLIC3R_GUI */
         << std::endl
         << "https://github.com/supermerill/slic3r" << std::endl << std::endl
-        << "Usage: slic3r [ ACTIONS ] [ TRANSFORM ] [ OPTIONS ] [ file.stl ... ]" << std::endl
+        << "Usage: prusa-slicer [ ACTIONS ] [ TRANSFORM ] [ OPTIONS ] [ file.stl ... ]" << std::endl
         << std::endl
         << "Actions:" << std::endl;
     cli_actions_config_def.print_cli_help(boost::nowide::cout, false);

+ 7 - 6
src/avrdude/arduino.c

@@ -41,6 +41,7 @@
 static int arduino_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
 {
   unsigned char buf[32];
+  (void)p;
 
   /* Signature byte reads are always 3 bytes. */
 
@@ -83,9 +84,9 @@ static int arduino_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
 static int prusa_init_external_flash(PROGRAMMER * pgm)
 {
   // Note: send/receive as in _the firmare_ send & receives
-  const char entry_magic_send   [] = "start\n";
-  const char entry_magic_receive[] = "w25x20cl_enter\n";
-  const char entry_magic_cfm    [] = "w25x20cl_cfm\n";
+  const char entry_magic_send[]             = "start\n";
+  const unsigned char entry_magic_receive[] = "w25x20cl_enter\n";
+  const char entry_magic_cfm[]              = "w25x20cl_cfm\n";
   const size_t buffer_len = 32;     // Should be large enough for the above messages
 
   int res;
@@ -94,7 +95,7 @@ static int prusa_init_external_flash(PROGRAMMER * pgm)
 
   // 1. receive the "start" command
   recv_size = sizeof(entry_magic_send) - 1;
-  res = serial_recv(&pgm->fd, buffer, recv_size);
+  res = serial_recv(&pgm->fd, (unsigned char *)buffer, recv_size);
   if (res < 0) {
     avrdude_message(MSG_INFO, "%s: prusa_init_external_flash(): MK3 printer did not boot up on time or serial communication failed\n", progname);
     return -1;
@@ -111,7 +112,7 @@ static int prusa_init_external_flash(PROGRAMMER * pgm)
 
   // 3. Receive the entry confirmation command
   recv_size = sizeof(entry_magic_cfm) - 1;
-  res = serial_recv(&pgm->fd, buffer, recv_size);
+  res = serial_recv(&pgm->fd, (unsigned char *)buffer, recv_size);
   if (res < 0) {
     avrdude_message(MSG_INFO, "%s: prusa_init_external_flash(): MK3 printer did not boot up on time or serial communication failed\n", progname);
     return -1;
@@ -142,7 +143,7 @@ static int arduino_open(PROGRAMMER * pgm, char * port)
 
   // Sometimes there may be line noise generating input on the printer's USB-to-serial IC
   // Here we try to clean its input buffer with a sequence of newlines (a minimum of 9 is needed):
-  const char cleanup_newlines[] = "\n\n\n\n\n\n\n\n\n\n";
+  const unsigned char cleanup_newlines[] = "\n\n\n\n\n\n\n\n\n\n";
   if (serial_send(&pgm->fd, cleanup_newlines, sizeof(cleanup_newlines) - 1) < 0) {
     return -1;
   }

+ 12 - 12
src/avrdude/avr.c

@@ -341,7 +341,7 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype,
     avr_tpi_setup_rw(pgm, mem, 0, TPI_NVMCMD_NO_OPERATION);
 
     /* load bytes */
-    for (lastaddr = i = 0; i < mem->size; i++) {
+    for (lastaddr = i = 0; i < (unsigned)mem->size; i++) {
       RETURN_IF_CANCEL();
       if (vmem == NULL ||
           (vmem->tags[i] & TAG_ALLOCATED) != 0)
@@ -374,7 +374,7 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype,
 
     /* quickly scan number of pages to be written to first */
     for (pageaddr = 0, npages = 0;
-         pageaddr < mem->size;
+         pageaddr < (unsigned)mem->size;
          pageaddr += mem->page_size) {
       /* check whether this page must be read */
       for (i = pageaddr;
@@ -391,7 +391,7 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype,
     }
 
     for (pageaddr = 0, failure = 0, nread = 0;
-         !failure && pageaddr < mem->size;
+         !failure && pageaddr < (unsigned)mem->size;
          pageaddr += mem->page_size) {
       RETURN_IF_CANCEL();
       /* check whether this page must be read */
@@ -437,7 +437,7 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype,
     }
   }
 
-  for (i=0; i < mem->size; i++) {
+  for (i = 0; i < (unsigned)mem->size; i++) {
     RETURN_IF_CANCEL();
     if (vmem == NULL ||
 	(vmem->tags[i] & TAG_ALLOCATED) != 0)
@@ -634,18 +634,18 @@ int avr_write_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
       writeop = mem->op[AVR_OP_WRITE_HI];
     else
       writeop = mem->op[AVR_OP_WRITE_LO];
-    caddr = addr / 2;
+    caddr = (unsigned short)(addr / 2);
   }
   else if (mem->paged && mem->op[AVR_OP_LOADPAGE_LO]) {
     if (addr & 0x01)
       writeop = mem->op[AVR_OP_LOADPAGE_HI];
     else
       writeop = mem->op[AVR_OP_LOADPAGE_LO];
-    caddr = addr / 2;
+    caddr = (unsigned short)(addr / 2);
   }
   else {
     writeop = mem->op[AVR_OP_WRITE];
-    caddr = addr;
+    caddr = (unsigned short)addr;
   }
 
   if (writeop == NULL) {
@@ -723,7 +723,7 @@ int avr_write_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
         gettimeofday (&tv, NULL);
         prog_time = (tv.tv_sec * 1000000) + tv.tv_usec;
       } while ((r != data) &&
-               ((prog_time-start_time) < mem->max_write_delay));
+               ((prog_time - start_time) < (unsigned long)mem->max_write_delay));
     }
 
     /*
@@ -878,7 +878,7 @@ int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
     }
 
     /* write words, low byte first */
-    for (lastaddr = i = 0; i < wsize; i += 2) {
+    for (lastaddr = i = 0; i < (unsigned)wsize; i += 2) {
       RETURN_IF_CANCEL();
       if ((m->tags[i] & TAG_ALLOCATED) != 0 ||
           (m->tags[i + 1] & TAG_ALLOCATED) != 0) {
@@ -915,7 +915,7 @@ int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
 
     /* quickly scan number of pages to be written to first */
     for (pageaddr = 0, npages = 0;
-         pageaddr < wsize;
+         pageaddr < (unsigned)wsize;
          pageaddr += m->page_size) {
       /* check whether this page must be written to */
       for (i = pageaddr;
@@ -928,7 +928,7 @@ int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
     }
 
     for (pageaddr = 0, failure = 0, nwritten = 0;
-         !failure && pageaddr < wsize;
+         !failure && pageaddr < (unsigned)wsize;
          pageaddr += m->page_size) {
       RETURN_IF_CANCEL();
       /* check whether this page must be written to */
@@ -968,7 +968,7 @@ int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
   page_tainted = 0;
   flush_page = 0;
 
-  for (i=0; i<wsize; i++) {
+  for (i = 0; i < (unsigned)wsize; i++) {
     RETURN_IF_CANCEL();
     data = m->buf[i];
     report_progress(i, wsize, NULL);

+ 1 - 1
src/avrdude/avr910.c

@@ -676,7 +676,7 @@ static int avr910_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
     avr910_set_addr(pgm, addr / rd_size);
 
     while (addr < max_addr) {
-      if ((max_addr - addr) < blocksize) {
+      if ((max_addr - addr) < (unsigned)blocksize) {
         blocksize = max_addr - addr;
       }
       cmd[1] = (blocksize >> 8) & 0xff;

+ 3 - 3
src/avrdude/avrdude-slic3r.conf.h

@@ -1,5 +1,5 @@
 /* WARN: This file is auto-generated from `avrdude-slic3r.conf` */
-unsigned char avrdude_slic3r_conf[] = {
+const unsigned char avrdude_slic3r_conf[] = {
     0x0a, 0x23, 0x0a, 0x23, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 
     0x20, 0x61, 0x20, 0x62, 0x61, 0x73, 0x69, 0x63, 0x20, 0x6d, 0x69, 0x6e, 
     0x69, 0x6d, 0x61, 0x6c, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x20, 
@@ -1184,5 +1184,5 @@ unsigned char avrdude_slic3r_conf[] = {
     0x20, 0x20, 0x3b, 0x0a, 0x0a, 0x0a, 
     0, 0
 };
-size_t avrdude_slic3r_conf_size = 14178;
-size_t avrdude_slic3r_conf_size_yy = 14180;
+const size_t avrdude_slic3r_conf_size = 14178;
+const size_t avrdude_slic3r_conf_size_yy = 14180;

+ 3 - 3
src/avrdude/avrdude-slic3r.cpp

@@ -93,7 +93,7 @@ void AvrDude::priv::unset_handlers()
 
 
 int AvrDude::priv::run_one(const std::vector<std::string> &args) {
-	std::vector<char*> c_args {{ const_cast<char*>(PACKAGE) }};
+	std::vector<char*> c_args { const_cast<char*>(PACKAGE) };
 	std::string command_line { PACKAGE };
 
 	for (const auto &arg : args) {
@@ -105,7 +105,7 @@ int AvrDude::priv::run_one(const std::vector<std::string> &args) {
 
 	HandlerGuard guard(*this);
 
-	message_fn(command_line.c_str(), command_line.size());
+	message_fn(command_line.c_str(), (unsigned)command_line.size());
 
 	const auto res = ::avrdude_main(static_cast<int>(c_args.size()), c_args.data());
 
@@ -200,7 +200,7 @@ AvrDude::Ptr AvrDude::run()
 				auto &message_fn = self->p->message_fn;
 				if (message_fn) {
 					message_fn(msg, sizeof(msg));
-					message_fn(what, std::strlen(what));
+					message_fn(what, (unsigned)std::strlen(what));
 					message_fn("\n", 1);
 				}
 

+ 2 - 0
src/avrdude/avrdude.h

@@ -64,6 +64,8 @@ int avrdude_main(int argc, char * argv []);
 #include <windows.h>
 #include <unistd.h>
 
+#define strdup _strdup
+
 #ifdef UNICODE
 #error "UNICODE should not be defined for avrdude bits on Windows"
 #endif

Some files were not shown because too many files changed in this diff