Hello,
I use Mega 2560 and I need to store large string variable (Zebra ZPL label code) and send it to serial label printer after altering specific bytes(label parameters i.e. barcode value, company name...etc).
In this tutorial Erel saved/restored array of long, kindly give short example how to save/restore string. Example of lablel code and image attached.
i will not alter progmem data at runtime, here is exactly what i want to do:
the string(ZPL code) consists of 2 parts, the big part is graphics data, no need to change it, and fields properties just 30 or 40 bytes, will change only it's text.
So i will send graphics part with no changes, after that, load fields part into tmp array and change needed bytes and then send it to printer.
You can use this B4J code to generate the PROGMEM data string:
B4X:
Sub StringToBytes(s As String)
Dim sb As StringBuilder
sb.Initialize
Dim bytes() As Byte = s.GetBytes("ascii")
For Each b As Byte In bytes
sb.Append("0x").Append(Bit.ToHexString(b)).Append(", ")
Next
sb.Remove(sb.Length - 2, sb.Length)
Log(sb.ToString)
End Sub