mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-11 11:02:32 +02:00
a648610d59
- **File formats:** - (Add) Wait time before cure: The time to rest/wait in seconds before cure a new layer - (Add) Wait time before after: The time to rest/wait in seconds after cure a new layer - (Add) Wait time after lift: The time to rest/wait in seconds after a lift/peel move - (Change) All gcode file formats dropped light-off delay field in favor of new 'Wait time before cure' field, setting light-off delay still valid but it redirects to the new field - (Change) Reorder 'Light-off delay' before 'Exposure time' - (Improvement) Recalculate the print time when a related property changes - (Fix) Generic time estimation calculation was ignoring exposure times - (Fix) Unable to load files with uppercase extensions - (Fix) ZIP: Use G1 at end of gcode instead of G0 - (Fix) CWS: Use G1 for movements - **(Fix) CXDLP:** (#240) - Layer area calculation - Validation checksum - **(Fix) ZCODE:** - Use G1 at end of gcode instead of G0 to prevent crash to top bug on firmware - Put back the M18 motors off at end of gcode - **GCode Builder/Parser:** - (Add) Allow to choose between G0 and G1 for layer movements and end gcode - (Fix) Safe guard: If the total print height is larger than set machine Z, do not raise/lower print on completeness - (Fix) Light-off delay is the real delay time and not the calculated movement of the lifts plus the extra time - (Improvement) Parse gcode line by line instead searching on a group of layers to allow a better control and identification - **Tools:** - **Change print parameters:** - (Add) Tooltips to labels - (Add) Sun UTF-8 to the Light PWM value unit to describe intensity - (Improvement) Dynamic lifts: Round lift height and speed to 1 decimal - (Fix) Exposure time finder: Time estimation when using 'Use different settings for layers with same Z positioning' - **Prusa Slicer:** - (Add) Note keyword: BottomWaitBeforeCure_xxx - (Add) Note keyword: WaitBeforeCure_xxx - (Add) Note keyword: BottomWaitAfterCure_xxx - (Add) Note keyword: WaitAfterCure_xxx - (Add) Note keyword: BottomWaitAfterLift_xxx - (Add) Note keyword: WaitAfterLift_xxx - (Change) Uniz IBEE: Remove light-off delay and implement wait time keywords - **macOS:** (#236) - (Remove) osx legacy packages from build and downloads - (Fix) macOS: Simplify the libcvextern.dylib and remove libtesseract dependency - (Fix) macOS: Include libusb-1.0.0.dylib - Note: `brew install libusb` still required - **UI:** - (Fix) Refresh gcode does not update text on UI for ZIP, CWS, ZCODEX files - (Fix) Operations: Import a .uvtop file by drag and drop into the UI would not load the layer range - (Change) When convert a file, the result dialog will have Yes, No and Cancel actions, where No will open the converted file on current window, while Cancel will not perform any action (The old No behaviour)
119 lines
4.4 KiB
C#
119 lines
4.4 KiB
C#
/*
|
|
* GNU AFFERO GENERAL PUBLIC LICENSE
|
|
* Version 3, 19 November 2007
|
|
* Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
* of this license document, but changing it is not allowed.
|
|
*/
|
|
namespace UVtools.Core.Extensions
|
|
{
|
|
public static class BitExtensions
|
|
{
|
|
public static ushort ToUShortLittleEndian(byte byte1, byte byte2) => (ushort)(byte1 + (byte2 << 8));
|
|
public static ushort ToUShortBigEndian(byte byte1, byte byte2) => (ushort)((byte1 << 8) + byte2);
|
|
|
|
public static ushort ToUShortLittleEndian(byte[] buffer, int offset = 0)
|
|
=> (ushort)(buffer[offset] + (buffer[offset+1] << 8));
|
|
public static ushort ToUShortBigEndian(byte[] buffer, int offset = 0)
|
|
=> (ushort)((buffer[offset] << 8) + buffer[offset+1]);
|
|
|
|
public static uint ToUIntLittleEndian(byte byte1, byte byte2, byte byte3, byte byte4)
|
|
=> (uint)(byte1 + (byte2 << 8) + (byte3 << 16) + (byte4 << 24));
|
|
public static uint ToUIntBigEndian(byte byte1, byte byte2, byte byte3, byte byte4)
|
|
=> (uint)((byte1 << 24) + (byte1 << 16) + (byte1 << 8) + byte2);
|
|
|
|
public static uint ToUIntLittleEndian(byte[] buffer, int offset = 0)
|
|
=> (uint)(buffer[offset] + (buffer[offset + 1] << 8) + (buffer[offset + 2] << 16) + (buffer[offset + 3] << 24));
|
|
public static uint ToUIntBigEndian(byte[] buffer, int offset = 0)
|
|
=> (uint)((buffer[offset] << 24) + (buffer[offset+1] << 16) + (buffer[offset+2] << 8) + buffer[offset+3]);
|
|
|
|
public static byte[] ToBytesLittleEndian(ushort value)
|
|
{
|
|
var bytes = new byte[2];
|
|
ToBytesLittleEndian(value, bytes);
|
|
return bytes;
|
|
}
|
|
|
|
public static void ToBytesLittleEndian(ushort value, byte[] buffer, uint offset = 0)
|
|
{
|
|
buffer[offset] = (byte)value;
|
|
buffer[offset + 1] = (byte)(value >> 8);
|
|
}
|
|
|
|
public static byte[] ToBytesBigEndian(ushort value)
|
|
{
|
|
var bytes = new byte[2];
|
|
ToBytesBigEndian(value, bytes);
|
|
return bytes;
|
|
}
|
|
|
|
public static void ToBytesBigEndian(ushort value, byte[] buffer, uint offset = 0)
|
|
{
|
|
buffer[offset] = (byte)(value >> 8);
|
|
buffer[offset + 1] = (byte)value;
|
|
}
|
|
|
|
public static byte[] ToBytesLittleEndian(uint value)
|
|
{
|
|
var bytes = new byte[4];
|
|
ToBytesLittleEndian(value, bytes);
|
|
return bytes;
|
|
}
|
|
|
|
public static void ToBytesLittleEndian(uint value, byte[] buffer, uint offset = 0)
|
|
{
|
|
buffer[offset] = (byte)value;
|
|
buffer[offset + 1] = (byte)(value >> 8);
|
|
buffer[offset + 2] = (byte)(value >> 16);
|
|
buffer[offset + 3] = (byte)(value >> 24);
|
|
}
|
|
|
|
public static byte[] ToBytesBigEndian(uint value)
|
|
{
|
|
var bytes = new byte[4];
|
|
ToBytesBigEndian(value, bytes);
|
|
return bytes;
|
|
}
|
|
|
|
public static void ToBytesBigEndian(uint value, byte[] buffer, uint offset = 0)
|
|
{
|
|
buffer[offset] = (byte)(value >> 24);
|
|
buffer[offset + 1] = (byte)(value >> 16);
|
|
buffer[offset + 2] = (byte)(value >> 8);
|
|
buffer[offset + 3] = (byte)value;
|
|
}
|
|
|
|
public static byte[] ToBytesLittleEndian(int value)
|
|
{
|
|
var bytes = new byte[4];
|
|
ToBytesLittleEndian(value, bytes);
|
|
return bytes;
|
|
}
|
|
|
|
public static void ToBytesLittleEndian(int value, byte[] buffer, uint offset = 0)
|
|
{
|
|
buffer[offset] = (byte)value;
|
|
buffer[offset + 1] = (byte)(value >> 8);
|
|
buffer[offset + 2] = (byte)(value >> 16);
|
|
buffer[offset + 3] = (byte)(value >> 24);
|
|
}
|
|
|
|
public static byte[] ToBytesBigEndian(int value)
|
|
{
|
|
var bytes = new byte[4];
|
|
ToBytesBigEndian(value, bytes);
|
|
return bytes;
|
|
}
|
|
|
|
public static void ToBytesBigEndian(int value, byte[] buffer, uint offset = 0)
|
|
{
|
|
buffer[offset] = (byte)(value >> 24);
|
|
buffer[offset + 1] = (byte)(value >> 16);
|
|
buffer[offset + 2] = (byte)(value >> 8);
|
|
buffer[offset + 3] = (byte)value;
|
|
}
|
|
|
|
|
|
}
|
|
}
|