From 5ee95c81092f512e595f98b6ad406e02afb5fdee Mon Sep 17 00:00:00 2001 From: EugeneTes Date: Fri, 3 Apr 2026 08:38:32 +0200 Subject: [PATCH] 1.0.12 --- EpsonPrintService/EpsonPrintService.csproj | 2 +- EpsonPrintService/Program.cs | 2 +- EpsonPrintService/config.txt | 2 +- Inspectron.Epson/EpsonPrinter.cs | 2 +- .../Printers/TM-T30IIITranslated.cs | 25 ++++++++++++------- .../Utils/BarReceipt/BarReceiptConverter.cs | 20 ++++++++++----- .../Printers/Utils/PrintCommand.cs | 5 ++++ 7 files changed, 39 insertions(+), 19 deletions(-) diff --git a/EpsonPrintService/EpsonPrintService.csproj b/EpsonPrintService/EpsonPrintService.csproj index 8e69454..505cace 100644 --- a/EpsonPrintService/EpsonPrintService.csproj +++ b/EpsonPrintService/EpsonPrintService.csproj @@ -5,7 +5,7 @@ net8.0 enable enable - 1.0.11 + 1.0.12 diff --git a/EpsonPrintService/Program.cs b/EpsonPrintService/Program.cs index d1d1a10..8700873 100644 --- a/EpsonPrintService/Program.cs +++ b/EpsonPrintService/Program.cs @@ -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) diff --git a/EpsonPrintService/config.txt b/EpsonPrintService/config.txt index 6b657d1..7f2fce7 100644 --- a/EpsonPrintService/config.txt +++ b/EpsonPrintService/config.txt @@ -1 +1 @@ -aHR0cHM6Ly9hcGkuZGV2Lmdhc3Ryb2phbWVzLmNoOzYzZTM3Mjk1YmQ2ZjI2ZGJkMzYxNjRjMDs3VnBaQXNTKzcwTEdKTXFRQi9nNWlkMlZIZ3FybmR4RUpXeDVLYXF2YThzPQ== \ No newline at end of file +aHR0cHM6Ly9hcGkuc3RhZ2UuZ2FzdHJvamFtZXMuY2g7NjI5MDU1MTc2ODQ3ODlhZmJjZTRkZTc5O05FOHh4TTMxNmJsWkcwajU2WTJnMkd5TEp2ekROQlNnU21yV1hwMzNhaDQ9 \ No newline at end of file diff --git a/Inspectron.Epson/EpsonPrinter.cs b/Inspectron.Epson/EpsonPrinter.cs index 8d0185c..d99319d 100644 --- a/Inspectron.Epson/EpsonPrinter.cs +++ b/Inspectron.Epson/EpsonPrinter.cs @@ -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); } /// diff --git a/Inspectron.Epson/PrintServer/Printers/TM-T30IIITranslated.cs b/Inspectron.Epson/PrintServer/Printers/TM-T30IIITranslated.cs index ec1214f..6fd8ff1 100644 --- a/Inspectron.Epson/PrintServer/Printers/TM-T30IIITranslated.cs +++ b/Inspectron.Epson/PrintServer/Printers/TM-T30IIITranslated.cs @@ -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,16 +57,17 @@ 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); await _printer.PrintTextAsync(command.Text + "\n"); } diff --git a/Inspectron.Epson/PrintServer/Printers/Utils/BarReceipt/BarReceiptConverter.cs b/Inspectron.Epson/PrintServer/Printers/Utils/BarReceipt/BarReceiptConverter.cs index e205ca0..1135dd3 100644 --- a/Inspectron.Epson/PrintServer/Printers/Utils/BarReceipt/BarReceiptConverter.cs +++ b/Inspectron.Epson/PrintServer/Printers/Utils/BarReceipt/BarReceiptConverter.cs @@ -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 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 diff --git a/Inspectron.Epson/PrintServer/Printers/Utils/PrintCommand.cs b/Inspectron.Epson/PrintServer/Printers/Utils/PrintCommand.cs index 395172c..9077b5e 100644 --- a/Inspectron.Epson/PrintServer/Printers/Utils/PrintCommand.cs +++ b/Inspectron.Epson/PrintServer/Printers/Utils/PrintCommand.cs @@ -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}"; + } } \ No newline at end of file