mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-26 01:52:48 +00:00
compression WIP
compression works. next is to store it in the proto as a oneof and then decompress it on use.
This commit is contained in:
parent
478274aff1
commit
a4bdef4151
@ -110,11 +110,14 @@ lib_ignore =
|
|||||||
ESP32 BLE Arduino
|
ESP32 BLE Arduino
|
||||||
platform_packages =
|
platform_packages =
|
||||||
framework-arduinoespressif32@https://github.com/meshtastic/arduino-esp32.git#4cde0f5d412d2695184f32e8a47e9bea57b45276
|
framework-arduinoespressif32@https://github.com/meshtastic/arduino-esp32.git#4cde0f5d412d2695184f32e8a47e9bea57b45276
|
||||||
; leave this commented out to avoid breaking Windows
|
|
||||||
|
|
||||||
|
; leave this commented out to avoid breaking Windows
|
||||||
;upload_port = /dev/ttyUSB0
|
;upload_port = /dev/ttyUSB0
|
||||||
;monitor_port = /dev/ttyUSB0
|
;monitor_port = /dev/ttyUSB0
|
||||||
|
|
||||||
|
upload_port = /dev/cu.SLAB_USBtoUART
|
||||||
|
monitor_port = /dev/cu.SLAB_USBtoUART
|
||||||
|
|
||||||
; customize the partition table
|
; customize the partition table
|
||||||
; http://docs.platformio.org/en/latest/platforms/espressif32.html#partition-tables
|
; http://docs.platformio.org/en/latest/platforms/espressif32.html#partition-tables
|
||||||
board_build.partitions = partition-table.csv
|
board_build.partitions = partition-table.csv
|
||||||
|
@ -325,26 +325,29 @@ Routing_Error perhapsEncode(MeshPacket *p)
|
|||||||
|
|
||||||
size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), Data_fields, &p->decoded);
|
size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), Data_fields, &p->decoded);
|
||||||
|
|
||||||
if (1) {
|
if (p->decoded.portnum == PortNum_TEXT_MESSAGE_APP) {
|
||||||
// int orig_len, compressed_len;
|
|
||||||
|
char original_payload[Constants_DATA_PAYLOAD_LEN];
|
||||||
|
memcpy(original_payload, p->decoded.payload.bytes, p->decoded.payload.size);
|
||||||
|
|
||||||
int compressed_len;
|
int compressed_len;
|
||||||
char compressed_out[100] = {0};
|
char compressed_out[100] = {0};
|
||||||
// char *orig = (char *)"Hiiiiiiii! :) How are you doing? I am doing well.";
|
|
||||||
// char *orig = (char *)"Meshtastic";
|
|
||||||
|
|
||||||
// orig_len = strlen(orig);
|
compressed_len = unishox2_compress_simple(original_payload, p->decoded.payload.size, compressed_out);
|
||||||
// compressed_len = unishox2_compress_simple(orig, orig_len, compressed_out);
|
|
||||||
compressed_len = unishox2_compress_simple((char *)bytes, numbytes, compressed_out);
|
|
||||||
|
|
||||||
|
Serial.print("Original length - ");
|
||||||
|
Serial.println(p->decoded.payload.size);
|
||||||
|
|
||||||
|
Serial.print("Compressed length - ");
|
||||||
Serial.println(compressed_len);
|
Serial.println(compressed_len);
|
||||||
Serial.println(compressed_out);
|
//Serial.println(compressed_out);
|
||||||
//&p->decoded.portnum;
|
|
||||||
|
|
||||||
char decompressed_out[100] = {};
|
char decompressed_out[100] = {};
|
||||||
int decompressed_len;
|
int decompressed_len;
|
||||||
|
|
||||||
decompressed_len = unishox2_decompress_simple(compressed_out, compressed_len, decompressed_out);
|
decompressed_len = unishox2_decompress_simple(compressed_out, compressed_len, decompressed_out);
|
||||||
|
|
||||||
|
Serial.print("Decompressed length - ");
|
||||||
Serial.println(decompressed_len);
|
Serial.println(decompressed_len);
|
||||||
Serial.println(decompressed_out);
|
Serial.println(decompressed_out);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user