Hi, thank you for the component, which works fine on raspberry, the only flaw is that it must be on a form. Because if I try to use this library. Compiles, but when using it faults.
unit Unit_Epson_TM_T70II;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LazSerial;
type
{ TEpson_TM_T70II }
TEpson_TM_T70II = class
private
Seriale: TLazSerial;
procedure Inizializza();
procedure LineeBianche(numero: integer);
public
constructor Create(Sender: TComponent; device: string);
function Stampa():boolean;
destructor Free();
end;
implementation
{ TEpson_TM_T70II }
procedure TEpson_TM_T70II.Inizializza;
begin
Seriale.WriteData(Chr(27) + Chr(64));
end;
procedure TEpson_TM_T70II.LineeBianche(numero: integer);
begin
if numero<0 then
numero:=0;
if numero>255 then
numero:=255;
Seriale.WriteData(chr(27) + chr(100) + chr(numero));
end;
constructor TEpson_TM_T70II.Create(Sender: TComponent; device: string);
begin
Seriale:=TLazSerial.Create(Sender);
Seriale.BaudRate:=br115200;
Seriale.DataBits:=db8bits;
Seriale.Device:=device;
Seriale.FlowControl:=fcNone;
Seriale.Parity:=pNone;
Seriale.StopBits:=sbOne;
Seriale.Active:=true;
end;
function TEpson_TM_T70II.Stampa: boolean;
begin
if Seriale.Active then
begin
Self.Inizializza();
Self.LineeBianche(5);
result:=true;
end else begin
result:=false;
end;
end;
destructor TEpson_TM_T70II.Free;
begin
Seriale.Active:=false;
Seriale.Free;
end;
end.
Error
TApplication.HandleException Access violation
Stack trace:
$003B9F08 TEPSON_TM_T70II__STAMPA, line 65 of unit_epson_tm_t70ii.pas
$00077E78 TFORM1__BUTTON1CLICK, line 41 of unit1.pas
$0024685C TCONTROL__CLICK, line 2711 of ./include/control.inc
$0027946C TBUTTONCONTROL__CLICK, line 54 of ./include/buttoncontrol.inc
$00279DFC TCUSTOMBUTTON__CLICK, line 169 of ./include/buttons.inc
$00279334 TBUTTONCONTROL__WMDEFAULTCLICKED, line 20 of ./include/buttoncontrol.inc
$00043124
$00234CB0 TWINCONTROL__WNDPROC, line 5326 of ./include/wincontrol.inc
$00336EBC DELIVERMESSAGE, line 112 of lclmessageglue.pas
$00347BDC GTK2WSBUTTON_CLICKED, line 2435 of gtk2wsstdctrls.pp
$76921AFC