Merge pull request #633 from aspadm/anet-n4-fixes

Anet n4 fixes
This commit is contained in:
Tiago Conceição
2023-01-01 18:04:34 +00:00
committed by GitHub
5 changed files with 68 additions and 68 deletions
+1 -1
View File
@@ -39,4 +39,4 @@ relative_correction_x = 1
relative_correction_y = 1
relative_correction_z = 1
slow_tilt_time = 8
thumbnails = 400x400,800x480
thumbnails = 260x140
+1 -1
View File
@@ -3,6 +3,7 @@
<include_workspace>false</include_workspace>
<relative_paths>true</relative_paths>
<auto_save>true</auto_save>
<file>anet.bt</file>
<file>ctb.bt</file>
<file>ctb_decrypted.bt</file>
<file>ctb_encrypted.bt</file>
@@ -12,7 +13,6 @@
<file>gr1.bt</file>
<file>lgs.bt</file>
<file>mdlp.bt</file>
<file>n4.bt</file>
<file>osf.bt</file>
<file>osla.bt</file>
<file>photons.bt</file>
+57
View File
@@ -0,0 +1,57 @@
//------------------------------------------------
//--- 010 Editor v8.0.1 Binary Template
//
// File: Anet N4, N7
// Authors: Tiago Conceição
//------------------------------------------------
BigEndian();
typedef struct() {
uint WhitePixelsCount <fgcolor=cBlack, bgcolor=cWhite>; // White pixels region (border including corner pixels)
uint XMin <fgcolor=cBlack, bgcolor=cWhite>; // Bounding rectangle X
uint YMin <fgcolor=cBlack, bgcolor=cWhite>; // Bounding rectangle Y
uint XMax <fgcolor=cBlack, bgcolor=cWhite>; // Bounding rectangle Right
uint YMax <fgcolor=cBlack, bgcolor=cWhite>; // Bounding rectangle Bottom
uint BitsCount <fgcolor=cBlack, bgcolor=cWhite>;
ubyte LayerRLE[(BitsCount + 7) >> 3] <fgcolor=cBlack, bgcolor=cRed>;
} layerData;
struct HEADER {
uint VersionLen <fgcolor=cBlack, bgcolor=cRed>; // 2
wchar_t Version[VersionLen/2] <fgcolor=cBlack, bgcolor=cRed>; // 3
int NameLength <fgcolor=cBlack, bgcolor=cRed>;
wchar_t FileName[NameLength/2] <fgcolor=cBlack, bgcolor=cRed>; // File name without extension
int DescriptionLength <fgcolor=cBlack, bgcolor=cRed>;
wchar_t Description[DescriptionLength/2] <fgcolor=cBlack, bgcolor=cRed>; // File name without extension
double XYPixelSize <fgcolor=cBlack, bgcolor=cRed>; // mm
double LayerHeight <fgcolor=cBlack, bgcolor=cRed>; // mm; from 0.03 to 0.08
uint BaseLayersCount <fgcolor=cBlack, bgcolor=cRed>; // Number of extent filled additional first layers; do not use!
uint FilledBaseLayersCount <fgcolor=cBlack, bgcolor=cRed>; // Number of fully filled first layers inside BaseLayersCount; do not use!
uint ExposureTime <fgcolor=cBlack, bgcolor=cRed>; // from 3 to 25
uint BottomExposureTime <fgcolor=cBlack, bgcolor=cRed>; // from 60 to 120
uint BottomLayerCount <fgcolor=cBlack, bgcolor=cRed>; // from 2 to 10
uint LiftSpeed <fgcolor=cBlack, bgcolor=cRed>; // mm/s, from 1 to 10
uint LiftHeight <fgcolor=cBlack, bgcolor=cRed>; // mm, from 3 to 10
uint PreviewResolutionX <fgcolor=cBlack, bgcolor=cRed>; // 260
uint PreviewResolutionY <fgcolor=cBlack, bgcolor=cRed>; // 140
uint PreviewSize <fgcolor=cBlack, bgcolor=cRed>; // 72866
ubyte PreviewContent[PreviewSize] <fgcolor=cBlack, bgcolor=0x00FF00>; // BMP image, BGR565
double VolumeMicroL <fgcolor=cBlack, bgcolor=cRed>; // µl
uint EncodedPrintTime <fgcolor=cBlack, bgcolor=cRed>; // s; for unknown reason always broken in original slicer
uint LayerCount <fgcolor=cBlack, bgcolor=cRed>;
} header;
struct LAYERS {
local int i;
for( i = 0; i < header.LayerCount; i++ ){
layerData lD();
}
} layers;
uint SupportsCount <fgcolor=cBlack, bgcolor=cYellow>; // Supports count, always 0
-57
View File
@@ -1,57 +0,0 @@
//------------------------------------------------
//--- 010 Editor v8.0.1 Binary Template
//
// File: Anet N4
// Authors: Tiago Conceição
//------------------------------------------------
BigEndian();
typedef struct() {
uint32 WhitePixelsCount <fgcolor=cBlack, bgcolor=cWhite>; // White pixels region (border including corner pixels)
uint32 XMin <fgcolor=cBlack, bgcolor=cWhite>; // Bounding rectangle X
uint32 YMin <fgcolor=cBlack, bgcolor=cWhite>; // Bounding rectangle Y
uint32 XMax <fgcolor=cBlack, bgcolor=cWhite>; // Bounding rectangle Right
uint32 YMax <fgcolor=cBlack, bgcolor=cWhite>; // Bounding rectangle Bottom
uint32 BitsCount <fgcolor=cBlack, bgcolor=cWhite>;
ubyte LayerRLE[(BitsCount + 7) >> 3] <fgcolor=cBlack, bgcolor=cRed>;
} layerData;
struct HEADER {
uint32 VersionLen <fgcolor=cBlack, bgcolor=cRed>; // 2
wchar_t Version[VersionLen/2] <fgcolor=cBlack, bgcolor=cRed>; // 3
uint32 NameLength <fgcolor=cBlack, bgcolor=cRed>;
wchar_t FileName[NameLength/2] <fgcolor=cBlack, bgcolor=cRed>; // File name without extension
uint32 DescriptionLength <fgcolor=cBlack, bgcolor=cRed>;
wchar_t Description[DescriptionLength/2] <fgcolor=cBlack, bgcolor=cRed>; // File name without extension
double XYPixelSize <fgcolor=cBlack, bgcolor=cRed>; // mm
double LayerHeight <fgcolor=cBlack, bgcolor=cRed>; // mm; from 0.03 to 0.08
uint32 BaseLayersCount <fgcolor=cBlack, bgcolor=cRed>; // Number of extent filled additional first layers; do not use!
uint32 FilledBaseLayersCount <fgcolor=cBlack, bgcolor=cRed>; // Number of fully filled first layers inside BaseLayersCount; do not use!
uint ExposureTime <fgcolor=cBlack, bgcolor=cRed>; // from 3 to 25
uint BottomExposureTime <fgcolor=cBlack, bgcolor=cRed>; // from 60 to 120
uint32 BottomLayerCount <fgcolor=cBlack, bgcolor=cRed>; // from 2 to 10
uint32 LiftSpeed <fgcolor=cBlack, bgcolor=cRed>; // mm/s, from 1 to 10
uint32 LiftHeight <fgcolor=cBlack, bgcolor=cRed>; // mm, from 3 to 10
uint32 PreviewResolutionX <fgcolor=cBlack, bgcolor=cRed>; // 260
uint32 PreviewResolutionY <fgcolor=cBlack, bgcolor=cRed>; // 140
uint32 PreviewSize <fgcolor=cBlack, bgcolor=cRed>; // 72866
ubyte PreviewContent[PreviewSize] <fgcolor=cBlack, bgcolor=0x00FF00>; // BMP image, BGR565
double VolumeMicroL <fgcolor=cBlack, bgcolor=cRed>; // µl
uint32 EncodedPrintTime <fgcolor=cBlack, bgcolor=cRed>; // s; for unknown reason always broken in original slicer
uint32 LayerCount <fgcolor=cBlack, bgcolor=cRed>;
} header;
struct LAYERS {
local int i;
for( i = 0; i < header.LayerCount; i++ ){
layerData lD();
}
} layers;
uint32 SupportsCount <fgcolor=cBlack, bgcolor=cYellow>; // Supports count, always 0
+9 -9
View File
@@ -60,12 +60,12 @@ public sealed class AnetN4File : FileFormat
public class Header
{
[FieldOrder(0)][FieldEndianness(Endianness.Big)] public uint VersionLength { get; set; } = 2;
[FieldOrder(0)][FieldEndianness(Endianness.Big)] public int VersionLength { get; set; } = 2;
[FieldOrder(1)][FieldEncoding("UTF-16BE")][FieldLength(nameof(VersionLength))] public string Version { get; set; } = "3";
[FieldOrder(2)][FieldEndianness(Endianness.Big)] public uint NameLength { get; set; } = (uint)About.SoftwareWithVersion.Length * 2;
[FieldOrder(2)][FieldEndianness(Endianness.Big)] public int NameLength { get; set; } = About.SoftwareWithVersion.Length * 2;
[FieldOrder(3)][FieldEncoding("UTF-16BE")][FieldLength(nameof(NameLength))] public string Name { get; set; } = About.SoftwareWithVersion;
[FieldOrder(4)][FieldEndianness(Endianness.Big)] public uint DescriptionLength { get; set; } = (uint)About.SoftwareWithVersion.Length * 2;
[FieldOrder(5)][FieldEncoding("UTF-16BE")][FieldLength(nameof(DescriptionLength))] public string Description { get; set; } = About.SoftwareWithVersion;
[FieldOrder(4)][FieldEndianness(Endianness.Big)] public int DescriptionLength { get; set; }
[FieldOrder(5)][FieldEncoding("UTF-16BE")][FieldLength(nameof(DescriptionLength))] public string Description { get; set; } = string.Empty; // Printer crashes for non-empty description (FW 1.65)
[FieldOrder(6)][FieldEndianness(Endianness.Big)] public double XYPixelSize { get; set; } = 0.04725; // mm
[FieldOrder(7)][FieldEndianness(Endianness.Big)] public double LayerHeight { get; set; } // mm; from 0.03 to 0.08
[FieldOrder(8)][FieldEndianness(Endianness.Big)] public uint BaseLayersCount { get; set; } // Number of extent filled additional first layers; do not use!
@@ -102,8 +102,8 @@ public sealed class AnetN4File : FileFormat
[FieldOrder(0)][FieldEndianness(Endianness.Big)] public uint WhitePixelsCount { get; set; }
[FieldOrder(1)][FieldEndianness(Endianness.Big)] public int XMin { get; set; }
[FieldOrder(2)][FieldEndianness(Endianness.Big)] public int YMin { get; set; }
[FieldOrder(3)][FieldEndianness(Endianness.Big)] public int XMax { get; set; } = RESOLUTION_X - 1;
[FieldOrder(4)][FieldEndianness(Endianness.Big)] public int YMax { get; set; } = RESOLUTION_Y - 1;
[FieldOrder(3)][FieldEndianness(Endianness.Big)] public int XMax { get; set; }
[FieldOrder(4)][FieldEndianness(Endianness.Big)] public int YMax { get; set; }
[FieldOrder(5)][FieldEndianness(Endianness.Big)] public uint BitsCount { get; set; }
[Ignore]
public uint RleBytesCount
@@ -123,8 +123,8 @@ public sealed class AnetN4File : FileFormat
WhitePixelsCount = layer.NonZeroPixelCount; // To be re-set latter while encoding
XMin = layer.BoundingRectangle.X;
YMin = layer.BoundingRectangle.Y;
XMax = layer.BoundingRectangle.Right;
YMax = layer.BoundingRectangle.Bottom;
if (layer.BoundingRectangle.Right > 0) XMax = layer.BoundingRectangle.Right - 1;
if (layer.BoundingRectangle.Bottom > 0) YMax = layer.BoundingRectangle.Bottom - 1;
}
public override string ToString()
@@ -429,7 +429,7 @@ public sealed class AnetN4File : FileFormat
using var outputFile = new FileStream(TemporaryOutputFileFullPath, FileMode.Create, FileAccess.Write);
HeaderSettings.Name = FilenameNoExt!;
HeaderSettings.Description = $"{About.SoftwareWithVersion} @ {DateTime.Now}";
HeaderSettings.Description = string.Empty; // $"{About.SoftwareWithVersion} @ {DateTime.Now}";
var previewBuffer = new byte[72866]; // 72866
BmpHeader.CopyTo(previewBuffer, 0);