ATC_TSLR_Paper: support HS 154 BWRY JD

This sends a full configuration instead of a single id because it is not supported officially by the firmware it seems

Tested with 1.54 inch Hanshow Nebular Pro 154Q-N (200x200 px)
This commit is contained in:
Andreas Shimokawa
2025-07-02 22:54:42 +02:00
parent cb03fb18bf
commit b610f7720f
2 changed files with 19 additions and 1 deletions
@@ -60,6 +60,7 @@ public class ATCTLSRPaperDeviceSupport extends AbstractBTLESingleDeviceSupport {
private static final Logger LOG = LoggerFactory.getLogger(ATCTLSRPaperDeviceSupport.class);
private static final byte[] COMMAND_GET_CONFIGURATION = new byte[]{0x00, 0x05};
private static final byte[] COMMAND_CONFIGURE_HS_154_BWRY_JD = new byte[]{0x00, 0x10, 0x26, 0x00, 0x6C, 0x00, 0x05, 0x00, 0x01, 0x01, 0x00, (byte) 0xC8, 0x00, (byte) 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x01, 0x02, 0x01, 0x10, 0x03, (byte) 0x80, 0x01, 0x02, 0x00, 0x00, 0x00, 0x04, 0x03, 0x00, 0x00, (byte) 0x80, 0x03, 0x40, 0x01, 0x20, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x02, 0x01, 0x10, 0x01, 0x08, 0x03, (byte) 0x80, 0x00, 0x00, 0x01, 0x02, 0x02, 0x02, 0x40, 0x02, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
private int epaper_width = 0;
private int epaper_height = 0;
private int epaper_colors = 0;
@@ -239,6 +240,10 @@ public class ATCTLSRPaperDeviceSupport extends AbstractBTLESingleDeviceSupport {
buf.position(32);
epaper_colors = buf.get();
if (epaper_width == 200 && epaper_height == 200 && model == 0x26) {
model = 10000; //HACK for unsupported HS 154 BWRY JD
}
LOG.info("decoded data: version={}, width={}, height={}, nr_colors={}, w/h swapped={}, model={}", version, epaper_width, epaper_height, epaper_colors, is_wh_swapped, model);
SharedPreferences.Editor editor = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).edit();
@@ -258,7 +263,12 @@ public class ATCTLSRPaperDeviceSupport extends AbstractBTLESingleDeviceSupport {
if (DeviceSettingsPreferenceConst.PREF_ATC_TSLR_PAPER_MODEL.equals(config)) {
SharedPreferences sharedPrefs = GBApplication.getDeviceSpecificSharedPrefs(getDevice().getAddress());
String display_model = sharedPrefs.getString(DeviceSettingsPreferenceConst.PREF_ATC_TSLR_PAPER_MODEL, "1");
builder.write(getCharacteristic(UUID_CHARACTERISTIC_MAIN), new byte[]{0x00, 0x04, 0x00, Byte.parseByte(display_model)});
int model = Integer.parseInt(display_model);
if (model == 10000) {// HACK: this is for the HS 213 BWRY JD type
builder.write(getCharacteristic(UUID_CHARACTERISTIC_MAIN), COMMAND_CONFIGURE_HS_154_BWRY_JD);
} else {
builder.write(getCharacteristic(UUID_CHARACTERISTIC_MAIN), new byte[]{0x00, 0x04, 0x00, (byte) model});
}
}
builder.queue(getQueue());
} catch (IOException e) {
+8
View File
@@ -5019,6 +5019,9 @@
<item name="31">HS 583 BWY UC</item>
<item name="6">HS 750 BWY UC</item>
<!-- hack, not officially in the list -->
<item name="10000">HS 154 BWRY JD</item>
<item name="38">HS 200 BWRY JD</item>
<item name="17">HS 350 BWRY JD</item>
<item name="37">HS 750 BWRY JD</item>
@@ -5032,6 +5035,8 @@
<item name="36">WO 290 BWRY JD</item>
<item name="39">WO 290 BWRY JD V2</item>
</string-array>
<string-array name="atc_tlsr_paper_models_values">
@@ -5068,6 +5073,9 @@
<item>31</item>
<item>6</item>
<!-- hack, not officially in the list -->
<item>10000</item>
<item>38</item>
<item>17</item>
<item>37</item>