This commit is contained in:
EugeneTes
2026-04-03 08:38:32 +02:00
parent 763cd1071b
commit 5ee95c8109
7 changed files with 39 additions and 19 deletions

View File

@@ -5,7 +5,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>1.0.11</Version>
<Version>1.0.12</Version>
</PropertyGroup>
<ItemGroup>

View File

@@ -3,7 +3,7 @@ using Inspectron.Epson.PrintServer.ConfigurationSources;
// Load configuration (may be absent on first boot)
var configResult = ConfigurationLoader.TryLoadFromFile();
configResult.Config.EmulationMode = true;
//configResult.Config.EmulationMode = true;
EpsonPrintServiceConfiguration? activeConfig = null;
if (configResult.Success)

View File

@@ -1 +1 @@
aHR0cHM6Ly9hcGkuZGV2Lmdhc3Ryb2phbWVzLmNoOzYzZTM3Mjk1YmQ2ZjI2ZGJkMzYxNjRjMDs3VnBaQXNTKzcwTEdKTXFRQi9nNWlkMlZIZ3FybmR4RUpXeDVLYXF2YThzPQ==
aHR0cHM6Ly9hcGkuc3RhZ2UuZ2FzdHJvamFtZXMuY2g7NjI5MDU1MTc2ODQ3ODlhZmJjZTRkZTc5O05FOHh4TTMxNmJsWkcwajU2WTJnMkd5TEp2ekROQlNnU21yV1hwMzNhaDQ9

View File

@@ -397,7 +397,7 @@ public class EpsonPrinter : IEpsonPrinter
public async Task CutAsync(bool fullCut=true)
{
_logger?.LogInformation("Cutting paper");
await SendRawAsync(EpsonCommands.CutPaperFull);
await SendRawAsync(fullCut ? EpsonCommands.CutPaperFull : EpsonCommands.CutPaperPartial);
}
/// <summary>

View File

@@ -44,6 +44,12 @@ public class TM_T30IIITranslated : IPrinter
foreach (var command in commands)
{
if (command.IsCut)
{
await _printer.FeedLinesAsync(10);
await _printer.CutAsync(false);
continue;
}
if(command.SetLineSpacing.HasValue)
{
Console.WriteLine($"Setting line spacing to {command.SetLineSpacing.Value}");
@@ -51,14 +57,15 @@ public class TM_T30IIITranslated : IPrinter
Console.WriteLine($"------------------------------------------------------");
continue;
}
if (command.IsBig)
{
await _printer.SetFontSizeAsync(2, 1);
}
else
{
await _printer.SetFontSizeAsync(1, 1);
}
await _printer.SetFontSizeAsync(command.IsBig?2:1, command.IsTall?2:1);
//if (command.IsBig)
//{
// await _printer.SetFontSizeAsync(2, 1);
//}
//else
//{
// await _printer.SetFontSizeAsync(1, 1);
//}
await _printer.SetEmphasized(command.IsBold);

View File

@@ -41,7 +41,7 @@ public class BarReceiptConverter
commands.Add(new PrintCommand(Center(kitchenReceipt.SpecialInstruction, true), true, true));
commands.Add(new PrintCommand(""));
}
commands.Add(new PrintCommand(""));
commands.Add(new PrintCommand(CreateDashedLine()));
@@ -52,11 +52,19 @@ public class BarReceiptConverter
foreach (Gang gang in kitchenReceipt.Gangs)
{
commands.Add(new PrintCommand(Center($"{gang.Id}. {gang.Name}", false)) { IsRed = true });
commands.Add(new PrintCommand(Center($"{gang.Id}. {gang.Name}", true)) { IsBig = true });
commands.Add(new PrintCommand(""));
commands.Add(new PrintCommand(""));
foreach (var dish in gang.Dishes)
{
PrintDish(dish, commands);
}
if (gang != kitchenReceipt.Gangs.Last())
{
commands.Add(new PrintCommand("") { IsCut = true });
commands.Add(new PrintCommand(""));
commands.Add(new PrintCommand(""));
}
}
if (kitchenReceipt.Gangs.Count > 0)
@@ -98,25 +106,25 @@ public class BarReceiptConverter
private static void PrintDish(Dish drink, List<PrintCommand> commands)
{
string drinkLine = $"{drink.Number}x {drink.Name}";
commands.Add(new PrintCommand(drinkLine,isBig:true));
commands.Add(new PrintCommand(drinkLine){IsTall = true});
// Modifications
if (drink.Modifications != null && (drink.Modifications.Removed.Any() || drink.Modifications.Added.Any()))
{
foreach (var removed in drink.Modifications.Removed)
{
commands.Add(new PrintCommand($" - {removed}", isBold:true));
commands.Add(new PrintCommand($" - {removed}", isBold:true){IsTall = true});
}
foreach (var added in drink.Modifications.Added)
{
commands.Add(new PrintCommand($" + {added}", isBold: true));
commands.Add(new PrintCommand($" + {added}", isBold: true){IsTall = true});
}
}
// SpecialInstruction
if (!string.IsNullOrEmpty(drink.Comment))
{
commands.Add(new PrintCommand($" Comment: {drink.Comment}", isBold: true));
commands.Add(new PrintCommand($" Comment: {drink.Comment}", isBold: true){IsTall = true});
}
commands.Add(new PrintCommand("")); // Extra line between drinks for bar

View File

@@ -15,4 +15,9 @@ public class PrintCommand
IsBig = isBig;
IsBold = isBold;
}
public override string ToString()
{
return $"Text: {Text}, IsBig: {IsBig}, IsBold: {IsBold}, IsRed: {IsRed}, SetLineSpacing: {SetLineSpacing}, IsCut: {IsCut}";
}
}