diff --git a/README.md b/README.md index 7731414..99c436d 100644 --- a/README.md +++ b/README.md @@ -46,3 +46,6 @@ No. For two reasons: ***Is possession and use of such devices legal ?*** There's no cracking, exploit, patent or copyright infrigement going on so IMO it's safe to assume this is perfectly legal. Just don't try changing price displays so you can get discounts, the price in the store's database obviously remains unchanged so you'll end up having to pay the correct price anyways. + +***My tricolor-capable ESL shows red garbage after an image update*** +Transmit the image in tricolor mode. Transmitting black and white images to tricolor ESLs doesn't clear the red layer. diff --git a/hardware/esl_blaster/FW03/Src/ir.c b/hardware/esl_blaster/FW03/Src/ir.c index 61e0761..fcc7ff4 100644 --- a/hardware/esl_blaster/FW03/Src/ir.c +++ b/hardware/esl_blaster/FW03/Src/ir.c @@ -31,14 +31,14 @@ static const uint32_t pp4_errors[4] = { // 0101: 123us (TIM16 31*4=124 Err=1) // 0110: 139us (TIM16 35*4=140 Err=1) // 0111: 131us (TIM16 33*4=132 Err=1) -// 0100: 83us (TIM16 21*4=84 Err=1) -// 0101: 59us (TIM16 15*4=60 Err=1) -// 0110: 75us (TIM16 19*4=76 Err=1) -// 0111: 67us (TIM16 17*4=68 Err=1) -// 0100: 91us (TIM16 23*4=92 Err=1) -// 0101: 115us (TIM16 29*4=116 Err=1) -// 0110: 99us (TIM16 25*4=100 Err=1) -// 0111: 107us (TIM16 27*4=108 Err=1) +// 1100: 83us (TIM16 21*4=84 Err=1) +// 1101: 59us (TIM16 15*4=60 Err=1) +// 1110: 75us (TIM16 19*4=76 Err=1) +// 1111: 67us (TIM16 17*4=68 Err=1) +// 1100: 91us (TIM16 23*4=92 Err=1) +// 1101: 115us (TIM16 29*4=116 Err=1) +// 1110: 99us (TIM16 25*4=100 Err=1) +// 1111: 107us (TIM16 27*4=108 Err=1) // Burst: 21us (TIM16 5 *4=20 Err=-1) static const uint32_t pp16_steps[16] = { 7-2-1, 13-2-1, 9-2-1, 11-2-1, 37-2-1, 31-2-1, 35-2-1, 33-2-1, diff --git a/images/152bwr.png b/images/152bwr.png new file mode 100644 index 0000000..9626d5b Binary files /dev/null and b/images/152bwr.png differ diff --git a/images/dm_128x64.png b/images/dm_128x64.png index 7de5835..4c66885 100644 Binary files a/images/dm_128x64.png and b/images/dm_128x64.png differ diff --git a/images/dm_64x64.png b/images/dm_64x64.png new file mode 100644 index 0000000..25e964f Binary files /dev/null and b/images/dm_64x64.png differ diff --git a/images/pommes.bmp b/images/pommes.bmp deleted file mode 100644 index a2833de..0000000 Binary files a/images/pommes.bmp and /dev/null differ diff --git a/tools_python/flashtest.py b/tools_python/flashtest.py index 0b8885c..18f896c 100644 --- a/tools_python/flashtest.py +++ b/tools_python/flashtest.py @@ -15,6 +15,7 @@ if (blaster_info[0] == "0"): ser = serial.Serial(blaster_info[0], 57600, timeout = 5) # 5s timeout for read ser.reset_input_buffer() +# Flags Repeats Delay Size Data frameA = [0x00, 0x00, 0x20, 0x00, 0x10, 0x00, 0x0B, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0xAB, 0x09, 0x00, 0x00, 0xF2, 0xA7] # Segment change page frameB = [0x00, 0x00, 0x20, 0x00, 0x10, 0x00, 0x0D, 0x00, 0x85, 0x00, 0x00, 0x00, 0x00, 0x06, 0xF1, 0x00, 0x00, 0x00, 0x0A, 0x5D, 0x14] # DM show debug infos @@ -44,6 +45,15 @@ for p in range(0, 8): print(ser.read()) +ba = bytearray() +ba.append(82) # R:Read flash +ser.write(ba) +ser.flush() +i = 0 +while ser.inWaiting(): + print(str(i) + " " + str(ser.read())) + i += 1 + ser.close() print("Done. Read flash to verify now.") diff --git a/tools_python/img2dm.py b/tools_python/img2dm.py index ac504bc..d13c26c 100644 --- a/tools_python/img2dm.py +++ b/tools_python/img2dm.py @@ -19,7 +19,6 @@ def image_convert(image, color_pass): pixels.append(0 if luma >= 0.1 and luma < 0.9 else 1) # 0 codes color (anything mid grey) else: pixels.append(0 if luma < 0.5 else 1) # 0 codes black - return pixels def record_run(run_count): @@ -28,7 +27,7 @@ def record_run(run_count): while run_count: bits.insert(0, run_count & 1) run_count >>= 1 - # Zero length coding + # Zero length coding - 1 for b in bits[1:]: compressed.append(0) if len(bits): @@ -40,7 +39,7 @@ def usage(): print("img2dm.py port image barcode (page color x y pp4)\n") print(" port: serial port name (0 for ESL Blaster)") print(" image: image file") - print(" barcode: 17-character barcode data") + print(" barcode: 17-character ESL barcode data") print(" page: page number to update (0~15), default: 0") print(" color: 0:Black and white only, 1:Color-capable ESL, default: 0") print(" x y: top-left position of image, default: 0 0") @@ -74,8 +73,6 @@ if (port == "0"): image = imread(sys.argv[2]) width = image.shape[1] height = image.shape[0] -# Medium size is 208*112 -print("Image is %i*%i, please make sure that this is equal or less than the ESL's display size." % (width, height)) # Get PLID from barcode string PLID = pr.get_plid(sys.argv[3]) @@ -86,16 +83,18 @@ pos_y = int(sys.argv[7]) if arg_count >= 8 else 0 if arg_count >= 9: if int(sys.argv[8]): pp16 = 0 + +# Medium size is 208*112 +print("Image is %i*%i in %s mode, please make sure that this suits your ESL's display." % (width, height, "color" if color_mode else "black and white")) # First pass for black and white pixels = image_convert(image, 0) if color_mode: - # Append second pass for color if needed + # Append second pass for color, if needed pixels += image_convert(image, 1) size_raw = len(pixels) -print("Compressing %i bits..." % size_raw) # First pixel bits = [] @@ -122,11 +121,11 @@ size_compressed = len(compressed) # Decide on compression or not # size_compressed = size_raw # Disable compression if size_compressed < size_raw: - print("Compression ratio: %.1f%%" % (100 - ((size_compressed * 100) / float(size_raw)))) + print("Compression ratio: %.1f%% (%d -> %d bytes)" % (100 - ((size_compressed * 100) / float(size_raw)), size_raw, size_compressed)) data = compressed compression_type = 2 else: - print("Compression ratio suxx, using raw data") + print("Compression ratio suxx, using raw data instead") data = pixels compression_type = 0 @@ -139,15 +138,13 @@ for b in range(0, padding): padded_data_size = len(data) frame_count = padded_data_size // bits_per_frame -print("Data size: %i (%i frames)" % (data_size, frame_count)) +#print("Data size: %i (%i frames)" % (data_size, frame_count)) frames = [] # Wake-up ping frame frames.append(pr.make_ping_frame(PLID, pp16, 400)) -print("Generating frames...") - # Parameters frame frame = pr.make_mcu_frame(PLID, 0x05) pr.append_word(frame, data_size // 8) # Total byte count for group diff --git a/tools_python/tx.py b/tools_python/tx.py index 3a8fd55..703477a 100644 --- a/tools_python/tx.py +++ b/tools_python/tx.py @@ -49,6 +49,12 @@ def search_esl_blaster(): result[0] = comport return result + +def show_progress(i, total, size, repeats, pp16): + if repeats > 100: + print("Transmitting wake-up frames, please wait...") # Lots of repeats certainly means this is a wake-up frame + else: + print("Transmitting frame %u/%u using %s, length %u, repeated %u times." % (i, total, "PP16" if pp16 else "PP4", size, repeats), end="\r", flush=True) def transmit_serial(frames, port): ser = serial.Serial(port, 57600, timeout = 10) # 10s timeout for read @@ -58,9 +64,9 @@ def transmit_serial(frames, port): for fr in frames: data_size = len(fr) - 2 repeats = fr[-2] + (fr[-1] * 256) - if repeats > 255: # Cap to one byte for the simple serial transmitter - repeats = 255 - print("Transmitting frame %u/%u, length %u, repeated %u times." % (i, frame_count, data_size, repeats)) + if repeats > 255: + repeats = 255 # Cap to one byte for the simple serial transmitter + show_progress(i, frame_count, data_size, repeats, 0) ba = bytearray() ba.append(data_size) @@ -72,7 +78,7 @@ def transmit_serial(frames, port): ser.flush() ser.read_until('A') i += 1 - + print("") ser.close() def transmit_esl_blaster(frames, pp16, port): @@ -88,10 +94,13 @@ def transmit_esl_blaster(frames, pp16, port): data_size = len(fr) - 2 repeats = fr[-2] + (fr[-1] * 256) - if repeats > 32767: # Cap to 15 bits because FW V2 uses bit 16 to indicate PP16 protocol - repeats = 32767 - - print("Transmitting frame %u/%u using %s, length %u, repeated %u times." % (i, frame_count, "PP16" if pp16 else "PP4", data_size, repeats)) + if repeats > 32767: + repeats = 32767 # Cap to 15 bits because FW V2 uses bit 16 to indicate PP16 protocol + #if repeats > 100: + # print("Transmitting wake-up frames, please wait...") # Lots of repeats certainly means this is a wake-up frame + #else: + # print("Transmitting frame %u/%u using %s, length %u, repeated %u times." % (i, frame_count, "PP16" if pp16 else "PP4", data_size, repeats), end="\r", flush=True) + show_progress(i, frame_count, data_size, repeats, pp16) if pp16: repeats |= 0x8000 @@ -99,7 +108,7 @@ def transmit_esl_blaster(frames, pp16, port): ba = bytearray() ba.append(76) # L:Load ba.append(data_size) - ba.append(30) # 30*50 = 1500 timer ticks between repeats + ba.append(10) # 30*50 = 1500 timer ticks between repeats ba.append(repeats & 255) ba.append((repeats // 256) & 255) for b in range(0, data_size): @@ -115,5 +124,5 @@ def transmit_esl_blaster(frames, pp16, port): ser.flush() ser.read_until(b'K') # Wait for transmit done i += 1 - + print("") ser.close()