forked from Yrr0r/paperang-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
89 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,32 @@ | ||
# WebBLE with Paperang | ||
|
||
The only thing this can do right now is print a self-diagnostics page. | ||
Prints redered markdown. Paper not padded after print finishes. Manual pull is required at the moment to get the full print area. | ||
|
||
|
||
Connect, then hit print. | ||
|
||
## Some useful BLE related constants: | ||
|
||
- Service ID: `49535343-fe7d-4ae5-8fa9-9fafd205e455` | ||
- Characteristic value to write to: `49535343-6daa-4d02-abf6-19569aca69fe` | ||
- Characteristic value to receive from the printer: `49535343-1e4d-4bd9-ba61-23c647249616` This is a NOTIFY character. | ||
|
||
|
||
|
||
## Some other tips on printing | ||
|
||
- BLE has a max data packet of 512, means 502 bytes of useful data. However, I found out that each packet should not contain unfinished lines otherwise they tear. So I rounded to 480 for 48 bytes per line on P1. | ||
|
||
## Other than just printing | ||
|
||
All send and receive data command byte are in `const.txt`. Send and receive has (almost) same data structure. When a packet is received, its also begin with 0x02 and end with 0x03. | ||
|
||
2nd byte is command byte, then the first 5 and last 5 bytes are not very useful since I don't care about checksums so I discarded them. Then the last 11 bytes of whats remaining seems to be some kind of redundant addon data, so they are disregarded as well. Then only a handful of bytes will remain and they are easier to decode. | ||
|
||
- Reading ASCII stringed values (SN, model, board version...) : Just do the right truncating and decode the rest as ASCII. | ||
- Battery status: Send command 16, only one byte will remain after all the truncating. That byte is the percentage value directly usable. Do not divide it again by 255. | ||
- Get heat density: Send 28, then look at the first byte returned. Same as battery status. Do not divide by 255. | ||
- Feed line: The printer will feed blank paper of a specific length. Send command 26, then immediately followed by the amount of lines(in pixel) to be fed encoded as payload data. | ||
|
||
- Power-down time: Send 31, get a 2 byte integer. Notice it's little endian means reverse their byte order to read them. i.e. `[16,14]` or `0x100E` indicate 3600 seconds, not 4110. | ||
|
||
- Characteristic ID: `49535343-6daa-4d02-abf6-19569aca69fe` | ||
> Some commands in the list are not implemented on the P1 model. I do not know whether it works on any other model. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
PRT_PRINT_DATA = 0 | ||
PRT_PRINT_DATA_COMPRESS = 1 | ||
PRT_FIRMWARE_DATA = 2 | ||
PRT_USB_UPDATE_FIRMWARE = 3 | ||
PRT_GET_VERSION = 4 | ||
PRT_SENT_VERSION = 5 | ||
PRT_GET_MODEL = 6 | ||
PRT_SENT_MODEL = 7 | ||
PRT_GET_BT_MAC = 8 | ||
PRT_SENT_BT_MAC = 9 | ||
PRT_GET_SN = 10 | ||
PRT_SENT_SN = 11 | ||
PRT_GET_STATUS = 12 | ||
PRT_SENT_STATUS = 13 | ||
PRT_GET_VOLTAGE = 14 | ||
PRT_SENT_VOLTAGE = 15 | ||
PRT_GET_BAT_STATUS = 16 | ||
PRT_SENT_BAT_STATUS = 17 | ||
PRT_GET_TEMP = 18 | ||
PRT_SENT_TEMP = 19 | ||
PRT_SET_FACTORY_STATUS = 20 | ||
PRT_GET_FACTORY_STATUS = 21 | ||
PRT_SENT_FACTORY_STATUS = 22 | ||
PRT_SENT_BT_STATUS = 23 | ||
PRT_SET_CRC_KEY = 24 | ||
PRT_SET_HEAT_DENSITY = 25 | ||
PRT_FEED_LINE = 26 | ||
PRT_PRINT_TEST_PAGE = 27 | ||
PRT_GET_HEAT_DENSITY = 28 | ||
PRT_SENT_HEAT_DENSITY = 29 | ||
PRT_SET_POWER_DOWN_TIME = 30 | ||
PRT_GET_POWER_DOWN_TIME = 31 | ||
PRT_SENT_POWER_DOWN_TIME = 32 | ||
PRT_FEED_TO_HEAD_LINE = 33 | ||
PRT_PRINT_DEFAULT_PARA = 34 | ||
PRT_GET_BOARD_VERSION = 35 | ||
PRT_SENT_BOARD_VERSION = 36 | ||
PRT_GET_HW_INFO = 37 | ||
PRT_SENT_HW_INFO = 38 | ||
PRT_SET_MAX_GAP_LENGTH = 39 | ||
PRT_GET_MAX_GAP_LENGTH = 40 | ||
PRT_SENT_MAX_GAP_LENGTH = 41 | ||
PRT_GET_PAPER_TYPE = 42 | ||
PRT_SENT_PAPER_TYPE = 43 | ||
PRT_SET_PAPER_TYPE = 44 | ||
PRT_GET_COUNTRY_NAME = 45 | ||
PRT_SENT_COUNTRY_NAME = 46 | ||
PRT_DISCONNECT_BT_CMD = 47 | ||
PRT_MAX_CMD = 48 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters