+ return (int)startIdx;
+}
+
+int IOdemodFSK(uint8_t *dest, size_t size, int *waveStartIdx) {
+ //make sure buffer has data
+ if (size < 66*64) return -2;
+ // FSK demodulator RF/64, fsk2a so invert, and fc/10/8
+ size = fskdemod(dest, size, 64, 1, 10, 8, waveStartIdx);
+ if (size < 65) return -3; //did we get a good demod?
+ //Index map
+ //0 10 20 30 40 50 60
+ //| | | | | | |
+ //01234567 8 90123456 7 89012345 6 78901234 5 67890123 4 56789012 3 45678901 23
+ //-----------------------------------------------------------------------------
+ //00000000 0 11110000 1 facility 1 version* 1 code*one 1 code*two 1 ???????? 11
+ //
+ //XSF(version)facility:codeone+codetwo
+ //Handle the data
+ size_t startIdx = 0;
+ uint8_t preamble[] = {0,0,0,0,0,0,0,0,0,1};
+ uint8_t errChk = preambleSearch(dest, preamble, sizeof(preamble), &size, &startIdx);
+ if (errChk == 0) return -4; //preamble not found
+
+ if (!dest[startIdx+8] && dest[startIdx+17]==1 && dest[startIdx+26]==1 && dest[startIdx+35]==1 && dest[startIdx+44]==1 && dest[startIdx+53]==1){
+ //confirmed proper separator bits found
+ //return start position
+ return (int) startIdx;
+ }
+ return -5;
+}
+
+// redesigned by marshmellow adjusted from existing decode functions
+// indala id decoding
+int indala64decode(uint8_t *bitStream, size_t *size, uint8_t *invert) {
+ //standard 64 bit indala formats including 26 bit 40134 format
+ uint8_t preamble64[] = {1,0,1,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 1};
+ uint8_t preamble64_i[] = {0,1,0,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 0};
+ size_t startidx = 0;
+ size_t found_size = *size;
+ bool found = preambleSearch(bitStream, preamble64, sizeof(preamble64), &found_size, &startidx);
+ if (!found) {
+ found = preambleSearch(bitStream, preamble64_i, sizeof(preamble64_i), &found_size, &startidx);
+ if (!found) return -1;
+ *invert ^= 1;