Added carrier wake up in Xylos TX and cute icons

This commit is contained in:
furrtek 2016-05-27 06:48:04 +02:00
parent 7a90eab407
commit 6a0816ba56
31 changed files with 636 additions and 285 deletions

View file

@ -0,0 +1,47 @@
const unsigned char bulb_ignore_bmp[] = {
0x42, 0x4d, 0xc6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 0x00,
0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00,
0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x70, 0x01,
0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x42, 0x47, 0x52, 0x73, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x19, 0x19, 0x19, 0x00, 0x29, 0x2e, 0x21, 0x00, 0x1b, 0x1b,
0x66, 0x00, 0x3f, 0x3f, 0x3f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x55, 0x55,
0x55, 0x00, 0x6c, 0x6c, 0x6c, 0x00, 0x95, 0x95, 0x95, 0x00, 0x0a, 0x44,
0x02, 0x77, 0x02, 0x77, 0x0a, 0x44, 0x00, 0x00, 0x00, 0x18, 0x42, 0x24,
0x44, 0x44, 0x47, 0x30, 0x03, 0x74, 0x44, 0x44, 0x42, 0x24, 0x00, 0x00,
0x00, 0x18, 0x42, 0x22, 0x44, 0x44, 0x73, 0x66, 0x55, 0x37, 0x44, 0x44,
0x22, 0x24, 0x00, 0x00, 0x00, 0x18, 0x44, 0x22, 0x24, 0x44, 0x76, 0x33,
0x33, 0x57, 0x44, 0x42, 0x22, 0x44, 0x00, 0x00, 0x00, 0x18, 0x44, 0x42,
0x22, 0x44, 0x73, 0x66, 0x55, 0x37, 0x44, 0x22, 0x24, 0x44, 0x00, 0x00,
0x00, 0x18, 0x44, 0x44, 0x22, 0x24, 0x76, 0x33, 0x33, 0x57, 0x42, 0x22,
0x44, 0x44, 0x00, 0x00, 0x00, 0x18, 0x44, 0x44, 0x42, 0x22, 0x73, 0x66,
0x55, 0x37, 0x22, 0x24, 0x44, 0x44, 0x00, 0x00, 0x06, 0x44, 0x00, 0x0c,
0x22, 0x26, 0x53, 0x35, 0x52, 0x22, 0x06, 0x44, 0x00, 0x00, 0x06, 0x44,
0x00, 0x0c, 0x42, 0x22, 0x31, 0x13, 0x22, 0x24, 0x06, 0x44, 0x00, 0x00,
0x06, 0x44, 0x00, 0x0c, 0x47, 0x22, 0x21, 0x12, 0x22, 0x74, 0x06, 0x44,
0x00, 0x00, 0x06, 0x44, 0x00, 0x0c, 0x74, 0x42, 0x22, 0x22, 0x24, 0x47,
0x06, 0x44, 0x00, 0x00, 0x00, 0x18, 0x44, 0x44, 0x47, 0x44, 0x44, 0x22,
0x22, 0x44, 0x44, 0x74, 0x44, 0x44, 0x00, 0x00, 0x00, 0x18, 0x44, 0x44,
0x47, 0x44, 0x64, 0x22, 0x22, 0x44, 0x44, 0x74, 0x44, 0x44, 0x00, 0x00,
0x00, 0x18, 0x44, 0x44, 0x74, 0x44, 0x62, 0x22, 0x22, 0x24, 0x44, 0x47,
0x44, 0x44, 0x00, 0x00, 0x00, 0x18, 0x44, 0x44, 0x74, 0x46, 0x22, 0x24,
0x42, 0x22, 0x44, 0x47, 0x44, 0x44, 0x00, 0x00, 0x00, 0x18, 0x44, 0x44,
0x74, 0x42, 0x22, 0x44, 0x44, 0x22, 0x24, 0x47, 0x44, 0x44, 0x00, 0x00,
0x00, 0x18, 0x44, 0x44, 0x74, 0x22, 0x23, 0x44, 0x44, 0x32, 0x22, 0x47,
0x44, 0x44, 0x00, 0x00, 0x00, 0x18, 0x44, 0x44, 0x72, 0x22, 0x60, 0x44,
0x44, 0x00, 0x22, 0x27, 0x44, 0x44, 0x00, 0x00, 0x00, 0x18, 0x44, 0x44,
0x22, 0x24, 0x66, 0x00, 0x00, 0x44, 0x42, 0x22, 0x44, 0x44, 0x00, 0x00,
0x00, 0x0a, 0x44, 0x42, 0x22, 0x44, 0x46, 0x00, 0x08, 0x44, 0x00, 0x06,
0x22, 0x24, 0x44, 0x00, 0x00, 0x00, 0x00, 0x08, 0x44, 0x22, 0x24, 0x74,
0x08, 0x44, 0x00, 0x08, 0x47, 0x42, 0x22, 0x44, 0x00, 0x00, 0x00, 0x08,
0x42, 0x22, 0x44, 0x47, 0x08, 0x44, 0x00, 0x08, 0x74, 0x44, 0x22, 0x24,
0x00, 0x00, 0x00, 0x18, 0x42, 0x24, 0x44, 0x44, 0x74, 0x44, 0x44, 0x47,
0x44, 0x44, 0x42, 0x24, 0x00, 0x00, 0x08, 0x44, 0x00, 0x08, 0x47, 0x77,
0x77, 0x74, 0x08, 0x44, 0x00, 0x01
};
const unsigned int bulb_ignore_bmp_len = 522;

View file

@ -0,0 +1,43 @@
const unsigned char bulb_off_bmp[] = {
0x42, 0x4d, 0x9a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x00,
0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00,
0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x48, 0x01,
0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x07, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x42, 0x47, 0x52, 0x73, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x39, 0x39, 0x39, 0x00, 0xff, 0x00, 0xff, 0x00, 0x55, 0x5f,
0x45, 0x00, 0x5b, 0x5b, 0x5b, 0x00, 0x7d, 0x7d, 0x7d, 0x00, 0x9d, 0x9d,
0x9d, 0x00, 0xff, 0xff, 0xff, 0x00, 0x0a, 0x11, 0x02, 0x66, 0x02, 0x66,
0x0a, 0x11, 0x00, 0x00, 0x08, 0x11, 0x00, 0x08, 0x16, 0x30, 0x03, 0x61,
0x08, 0x11, 0x00, 0x00, 0x08, 0x11, 0x00, 0x08, 0x63, 0x55, 0x44, 0x36,
0x08, 0x11, 0x00, 0x00, 0x08, 0x11, 0x00, 0x08, 0x65, 0x33, 0x33, 0x46,
0x08, 0x11, 0x00, 0x00, 0x08, 0x11, 0x00, 0x08, 0x63, 0x55, 0x44, 0x36,
0x08, 0x11, 0x00, 0x00, 0x08, 0x11, 0x00, 0x08, 0x65, 0x33, 0x33, 0x46,
0x08, 0x11, 0x00, 0x00, 0x08, 0x11, 0x00, 0x08, 0x63, 0x55, 0x44, 0x36,
0x08, 0x11, 0x00, 0x00, 0x08, 0x11, 0x00, 0x08, 0x65, 0x43, 0x34, 0x46,
0x08, 0x11, 0x00, 0x00, 0x08, 0x11, 0x00, 0x08, 0x63, 0x32, 0x23, 0x36,
0x08, 0x11, 0x00, 0x00, 0x06, 0x11, 0x00, 0x0c, 0x16, 0x11, 0x22, 0x22,
0x11, 0x61, 0x06, 0x11, 0x00, 0x00, 0x06, 0x11, 0x00, 0x0c, 0x61, 0x11,
0x24, 0x22, 0x11, 0x16, 0x06, 0x11, 0x00, 0x00, 0x00, 0x18, 0x11, 0x11,
0x16, 0x11, 0x11, 0x24, 0x22, 0x11, 0x11, 0x61, 0x11, 0x11, 0x00, 0x00,
0x00, 0x18, 0x11, 0x11, 0x16, 0x11, 0x51, 0x34, 0x43, 0x11, 0x11, 0x61,
0x11, 0x11, 0x00, 0x00, 0x00, 0x18, 0x11, 0x11, 0x61, 0x11, 0x51, 0x31,
0x13, 0x11, 0x11, 0x16, 0x11, 0x11, 0x00, 0x00, 0x00, 0x18, 0x11, 0x11,
0x61, 0x15, 0x51, 0x31, 0x13, 0x11, 0x11, 0x16, 0x11, 0x11, 0x00, 0x00,
0x00, 0x18, 0x11, 0x11, 0x61, 0x15, 0x53, 0x11, 0x11, 0x31, 0x11, 0x16,
0x11, 0x11, 0x00, 0x00, 0x00, 0x18, 0x11, 0x11, 0x61, 0x15, 0x53, 0x11,
0x11, 0x31, 0x11, 0x16, 0x11, 0x11, 0x00, 0x00, 0x00, 0x18, 0x11, 0x11,
0x61, 0x11, 0x50, 0x11, 0x11, 0x00, 0x11, 0x16, 0x11, 0x11, 0x00, 0x00,
0x00, 0x18, 0x11, 0x11, 0x16, 0x11, 0x55, 0x00, 0x00, 0x11, 0x11, 0x61,
0x11, 0x11, 0x00, 0x00, 0x00, 0x0a, 0x11, 0x11, 0x16, 0x11, 0x15, 0x00,
0x08, 0x11, 0x00, 0x06, 0x61, 0x11, 0x11, 0x00, 0x00, 0x00, 0x06, 0x11,
0x02, 0x61, 0x08, 0x11, 0x02, 0x16, 0x06, 0x11, 0x00, 0x00, 0x06, 0x11,
0x02, 0x16, 0x08, 0x11, 0x02, 0x61, 0x06, 0x11, 0x00, 0x00, 0x08, 0x11,
0x00, 0x08, 0x61, 0x11, 0x11, 0x16, 0x08, 0x11, 0x00, 0x00, 0x08, 0x11,
0x00, 0x08, 0x16, 0x66, 0x66, 0x61, 0x08, 0x11, 0x00, 0x01
};
const unsigned int bulb_off_bmp_len = 478;

View file

@ -0,0 +1,46 @@
const unsigned char bulb_on_bmp[] = {
0x42, 0x4d, 0xba, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0x00,
0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00,
0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x60, 0x01,
0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x09, 0x00,
0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x42, 0x47, 0x52, 0x73, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x39, 0x39, 0x39, 0x00, 0xff, 0x00, 0xff, 0x00, 0x5b, 0x5b,
0x5b, 0x00, 0x7d, 0x7d, 0x7d, 0x00, 0x90, 0xa0, 0x75, 0x00, 0x9d, 0x9d,
0x9d, 0x00, 0x44, 0xe5, 0xff, 0x00, 0x85, 0xfe, 0xff, 0x00, 0xff, 0xff,
0xff, 0x00, 0x0a, 0x11, 0x02, 0x88, 0x02, 0x88, 0x0a, 0x11, 0x00, 0x00,
0x08, 0x11, 0x00, 0x08, 0x18, 0x20, 0x02, 0x81, 0x08, 0x11, 0x00, 0x00,
0x08, 0x11, 0x00, 0x08, 0x82, 0x55, 0x33, 0x28, 0x08, 0x11, 0x00, 0x00,
0x08, 0x11, 0x00, 0x08, 0x85, 0x22, 0x22, 0x38, 0x08, 0x11, 0x00, 0x00,
0x08, 0x11, 0x00, 0x08, 0x82, 0x55, 0x33, 0x28, 0x08, 0x11, 0x00, 0x00,
0x08, 0x11, 0x00, 0x08, 0x85, 0x22, 0x22, 0x38, 0x08, 0x11, 0x00, 0x00,
0x08, 0x11, 0x00, 0x08, 0x82, 0x55, 0x32, 0x28, 0x08, 0x11, 0x00, 0x00,
0x00, 0x18, 0x11, 0x61, 0x11, 0x11, 0x85, 0x33, 0x33, 0x28, 0x11, 0x11,
0x16, 0x11, 0x00, 0x00, 0x00, 0x18, 0x11, 0x16, 0x11, 0x11, 0x83, 0x54,
0x45, 0x38, 0x11, 0x11, 0x61, 0x11, 0x00, 0x00, 0x00, 0x18, 0x11, 0x11,
0x61, 0x18, 0x77, 0x44, 0x44, 0x77, 0x81, 0x16, 0x11, 0x11, 0x00, 0x00,
0x06, 0x11, 0x00, 0x0c, 0x87, 0x66, 0x48, 0x44, 0x66, 0x78, 0x06, 0x11,
0x00, 0x00, 0x00, 0x18, 0x11, 0x11, 0x18, 0x76, 0x66, 0x48, 0x44, 0x66,
0x67, 0x81, 0x11, 0x11, 0x00, 0x00, 0x00, 0x18, 0x11, 0x11, 0x18, 0x66,
0x86, 0x38, 0x83, 0x66, 0x66, 0x81, 0x11, 0x11, 0x00, 0x00, 0x00, 0x18,
0x11, 0x11, 0x87, 0x67, 0x87, 0x37, 0x63, 0x76, 0x66, 0x78, 0x11, 0x11,
0x00, 0x00, 0x00, 0x18, 0x11, 0x11, 0x86, 0x78, 0x86, 0x36, 0x73, 0x67,
0x67, 0x68, 0x11, 0x11, 0x00, 0x00, 0x00, 0x18, 0x66, 0x61, 0x86, 0x68,
0x83, 0x67, 0x76, 0x36, 0x76, 0x68, 0x16, 0x66, 0x00, 0x00, 0x00, 0x18,
0x11, 0x11, 0x86, 0x78, 0x85, 0x77, 0x77, 0x57, 0x77, 0x68, 0x11, 0x11,
0x00, 0x00, 0x00, 0x18, 0x11, 0x11, 0x87, 0x67, 0x88, 0x78, 0x77, 0x88,
0x76, 0x78, 0x11, 0x11, 0x00, 0x00, 0x00, 0x08, 0x11, 0x11, 0x18, 0x66,
0x06, 0x88, 0x00, 0x0a, 0x77, 0x77, 0x81, 0x11, 0x11, 0x00, 0x00, 0x00,
0x00, 0x18, 0x11, 0x11, 0x18, 0x76, 0x78, 0x77, 0x77, 0x76, 0x76, 0x81,
0x11, 0x11, 0x00, 0x00, 0x06, 0x11, 0x02, 0x87, 0x08, 0x67, 0x02, 0x68,
0x06, 0x11, 0x00, 0x00, 0x00, 0x0a, 0x11, 0x11, 0x61, 0x18, 0x76, 0x00,
0x06, 0x66, 0x00, 0x08, 0x81, 0x16, 0x11, 0x11, 0x00, 0x00, 0x00, 0x18,
0x11, 0x16, 0x11, 0x11, 0x87, 0x77, 0x77, 0x78, 0x11, 0x11, 0x61, 0x11,
0x00, 0x00, 0x00, 0x18, 0x11, 0x61, 0x11, 0x11, 0x18, 0x88, 0x88, 0x81,
0x11, 0x11, 0x16, 0x11, 0x00, 0x01
};
const unsigned int bulb_on_bmp_len = 510;

View file

@ -1,4 +1,4 @@
unsigned char fox_bmp[] = {
const unsigned char fox_bmp[] = {
0x42, 0x4d, 0xee, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, 0x00,
0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0xa0, 0x00,
0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x2b,

View file

@ -19,6 +19,9 @@
* Boston, MA 02110-1301, USA.
*/
// Bitmaps generated with:
// Gimp :(, then "xxd -i *.bmp"
//BUG: No audio in about when shown second time
//BUG: Description doesn't show up first time going to system>module info (UI drawn on top)
//TODO: Breakout game

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View file

@ -1,7 +1,4 @@
// Generated with:
// Gimp :(, then "xxd -i *.bmp"
unsigned char splash_bmp[] = {
const unsigned char splash_bmp[] = {
0x42, 0x4d, 0x28, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00,
0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0xb9, 0x00, 0x00, 0x00, 0x1b, 0x01,
0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0xb2, 0x31,

View file

@ -100,7 +100,7 @@ void CloseCallView::do_detection() {
else
resolved_frequency = slice_start + (CC_BIN_WIDTH * (imax - 118)); // Init
text_debug.set(to_string_dec_int(CC_BIN_WIDTH * (imax - 118))); //imax
//text_debug.set(to_string_dec_int(CC_BIN_WIDTH * (imax - 118)));
// Correct according to DC spike mask width (4 for now)
if (iraw > 118)
@ -160,77 +160,76 @@ void CloseCallView::on_channel_spectrum(const ChannelSpectrum& spectrum) {
uint8_t threshold;
size_t i, m;
if (!wait) {
// Spectrum line (for debug)
std::array<Color, 240> pixel_row;
for(i = 0; i < 118; i++) {
const auto pixel_color = spectrum_rgb3_lut[spectrum.db[256 - 120 + i]];
pixel_row[i + 2] = pixel_color;
}
for(i = 122; i < 240; i++) {
const auto pixel_color = spectrum_rgb3_lut[spectrum.db[i - 120]];
pixel_row[i - 2] = pixel_color;
}
display.draw_pixels(
{ { 0, 96 + slices_counter * 6 }, { pixel_row.size(), 1 } },
pixel_row
);
// Find max for this slice:
// Check if left of slice needs to be trimmed (masked)
if (slices_counter == 0)
i = slice_trim;
else
i = 0;
for ( ; i < 118; i++) {
threshold = spectrum.db[256 - 120 + i]; // 128+8 = 136 ~254
if (threshold > xmax) {
xmax = threshold;
imax = i;
}
}
// Check if right of slice needs to be trimmed (masked)
if (slices_counter == (slices_max - 1))
m = 240 - slice_trim;
else
m = 240;
for (i = 122 ; i < m; i++) {
threshold = spectrum.db[i - 120]; // 240-120 = 120 -> +8 = 128
if (threshold > xmax) { // (0~2) 2~120 (120~136) 136~254 (254~256)
xmax = threshold;
imax = i - 4;
}
}
slicemax_db[slices_counter] = xmax;
slicemax_idx[slices_counter] = imax;
// Add to mean
for (i = 136; i < 254; i++)
mean += spectrum.db[i];
for (i = 2; i < 120; i++)
mean += spectrum.db[i];
// Slice update
if (slicing) {
if (slices_counter >= (slices_max - 1)) {
do_detection();
mean = 0;
slices_counter = 0;
} else {
slices_counter++;
}
slice_frequency = slice_start + (slices_counter * CC_SLICE_WIDTH);
receiver_model.set_tuning_frequency(slice_frequency);
wait = 1;
} else {
do_detection();
}
} else {
wait--;
baseband::spectrum_streaming_stop;
// Spectrum line (for debug)
std::array<Color, 240> pixel_row;
for(i = 0; i < 118; i++) {
const auto pixel_color = spectrum_rgb3_lut[spectrum.db[256 - 120 + i]];
pixel_row[i + 2] = pixel_color;
}
for(i = 122; i < 240; i++) {
const auto pixel_color = spectrum_rgb3_lut[spectrum.db[i - 120]];
pixel_row[i - 2] = pixel_color;
}
display.draw_pixels(
{ { 0, 96 + slices_counter * 4 }, { pixel_row.size(), 1 } },
pixel_row
);
// Find max for this slice:
// Check if left of slice needs to be trimmed (masked)
if (slices_counter == 0)
i = slice_trim;
else
i = 0;
for ( ; i < 118; i++) {
threshold = spectrum.db[256 - 120 + i]; // 128+8 = 136 ~254
if (threshold > xmax) {
xmax = threshold;
imax = i;
}
}
// Check if right of slice needs to be trimmed (masked)
if (slices_counter == (slices_max - 1))
m = 240 - slice_trim;
else
m = 240;
for (i = 122 ; i < m; i++) {
threshold = spectrum.db[i - 120]; // 240-120 = 120 -> +8 = 128
if (threshold > xmax) { // (0~2) 2~120 (120~136) 136~254 (254~256)
xmax = threshold;
imax = i - 4;
}
}
slicemax_db[slices_counter] = xmax;
slicemax_idx[slices_counter] = imax;
// Add to mean
for (i = 136; i < 254; i++)
mean += spectrum.db[i];
for (i = 2; i < 120; i++)
mean += spectrum.db[i];
// Slice update
if (slicing) {
if (slices_counter >= (slices_max - 1)) {
do_detection();
mean = 0;
slices_counter = 0;
} else {
slices_counter++;
}
slice_frequency = slice_start + (slices_counter * CC_SLICE_WIDTH);
receiver_model.set_tuning_frequency(slice_frequency);
} else {
do_detection();
}
baseband::spectrum_streaming_start(1);
}
void CloseCallView::on_show() {
@ -266,9 +265,7 @@ void CloseCallView::on_range_changed() {
rf::Frequency slices_span;
rf::Frequency resolved_frequency;
int64_t offset;
// DEBUG
/*
f_max = field_frequency_max.value();
f_min = field_frequency_min.value();
scan_span = abs(f_max - f_min);
@ -288,7 +285,6 @@ void CloseCallView::on_range_changed() {
slice_start = slice_frequency;
receiver_model.set_tuning_frequency(slice_frequency);
// DEBUG
resolved_frequency = (CC_SLICE_WIDTH - scan_span) / 2; // Trim frequency span (for both sides)
resolved_frequency /= CC_BIN_WIDTH; // Convert to bin span
slice_trim = resolved_frequency;
@ -300,8 +296,9 @@ void CloseCallView::on_range_changed() {
slices_max = 1;
slices_counter = 0;
slicing = false;
}*/
}
/*
f_min = field_frequency_min.value();
scan_span = 3000000;
slice_frequency = (f_min + 1500000);
@ -312,6 +309,7 @@ void CloseCallView::on_range_changed() {
slices_counter = 0;
slicing = false;
field_frequency_max.set_value(f_min + 3000000);
*/
text_slices.set(to_string_dec_int(slices_max));
slices_counter = 0;

View file

@ -61,7 +61,6 @@ private:
Coord last_pos = 0;
ChannelSpectrumFIFO* fifo { nullptr };
uint8_t detect_counter = 0, release_counter = 0;
uint8_t wait = 2;
uint8_t slice_trim;
uint32_t mean = 0;
uint32_t min_threshold = 80; // Todo: Put this in persistent / settings

View file

@ -183,14 +183,15 @@ ReceiverMenuView::ReceiverMenuView(NavigationView& nav) {
/* SystemMenuView ********************************************************/
SystemMenuView::SystemMenuView(NavigationView& nav) {
add_items<12>({ {
add_items<11>({ {
{ "Play dead", ui::Color::red(), [&nav](){ nav.push<PlayDeadView>(false); } },
{ "Receiver RX", ui::Color::cyan(), [&nav](){ nav.push<LoadModuleView>(md5_baseband, Receiver); } },
{ "Close Call RX", ui::Color::cyan(), [&nav](){ nav.push<LoadModuleView>(md5_baseband, CloseCall); } },
{ "Soundboard TX", ui::Color::yellow(), [&nav](){ nav.push<LoadModuleView>(md5_baseband_tx, SoundBoard); } },
//{ "Audio TX", ui::Color::yellow(), [&nav](){ nav.push<LoadModuleView>(md5_baseband_tx, AudioTX); } },
{ "EPAR TX", ui::Color::green(), [&nav](){ nav.push<LoadModuleView>(md5_baseband_tx, EPAR); } },
{ "Xylos TX", ui::Color::orange(), [&nav](){ nav.push<LoadModuleView>(md5_baseband_tx, Xylos); } },
//{ "EPAR TX", ui::Color::green(), [&nav](){ nav.push<LoadModuleView>(md5_baseband_tx, EPAR); } },
{ "Xylos TX", ui::Color::green(), [&nav](){ nav.push<LoadModuleView>(md5_baseband_tx, Xylos); } },
{ "TEDI/LCR TX", ui::Color::orange(), [&nav](){ nav.push<LoadModuleView>(md5_baseband_tx, LCR); } },
{ "RDS TX", ui::Color::yellow(), [&nav](){ nav.push<LoadModuleView>(md5_baseband_tx, RDS); } },
//{ "Capture", ui::Color::white(), [&nav](){ nav.push<NotImplementedView>(); } },
@ -315,7 +316,7 @@ BMPView::BMPView(NavigationView& nav) {
void BMPView::paint(Painter& painter) {
(void)painter;
portapack::display.drawBMP({(240-185)/2, 0}, splash_bmp);
portapack::display.drawBMP({(240-185)/2, 0}, splash_bmp, false);
}
/* PlayDeadView **********************************************************/

View file

@ -43,7 +43,8 @@
using namespace portapack;
namespace ui {
/*
void XylosRXView::talk() {
uint8_t c;
@ -79,15 +80,6 @@ XylosRXView::~XylosRXView() {
receiver_model.disable();
}
/*VirtualTimer vt;
void XylosRXView::do_something(void *p) {
//p.set(xylos_voice_filenames[xylos_voice_phrase[p_idx]]);
//p_idx++;
//} while (xylos_voice_phrase[p_idx] != 0xFF);
text_dbg.set("Done :)");
}*/
void XylosRXView::on_show() {
//chVTSet(&vt, MS2ST(1000), do_something, NULL);
}
@ -116,7 +108,7 @@ XylosRXView::XylosRXView(
};
}
*/
@ -143,10 +135,12 @@ void XylosView::upd_message() {
ccirmessage[4] = (city_code.value() / 10) + 0x30;
ccirmessage[5] = (city_code.value() % 10) + 0x30;
ccirmessage[6] = family_code.value() + 0x30;
if (checkbox_wcsubfamily.value() == false)
ccirmessage[7] = subfamily_code.value() + 0x30;
else
ccirmessage[7] = 'A';
if (checkbox_wcid.value() == false) {
ccirmessage[8] = (receiver_code.value() / 10) + 0x30;
ccirmessage[9] = (receiver_code.value() % 10) + 0x30;
@ -160,7 +154,7 @@ void XylosView::upd_message() {
ccirmessage[11] = options_ra.selected_index() + 0x30;
ccirmessage[12] = options_rb.selected_index() + 0x30;
ccirmessage[13] = options_rc.selected_index() + 0x30;
ccirmessage[14] = '0';
ccirmessage[14] = options_rd.selected_index() + 0x30;
ccirmessage[15] = 'B';
@ -177,7 +171,7 @@ void XylosView::upd_message() {
ccirmessage[20] = 0;
// Display as text
text_debug.set(ccirmessage);
text_message.set(ccirmessage);
// ASCII to frequency LUT index
for (c=0; c<20; c++) {
@ -190,19 +184,7 @@ void XylosView::upd_message() {
ccirmessage[20] = 0xFF;
}
void XylosView::journuit() {
uint8_t sr;
chThdSleepMilliseconds(1000);
// Invert relay states
sr = options_ra.selected_index();
if (sr > 0) options_ra.set_selected_index(sr ^ 3);
sr = options_rb.selected_index();
if (sr > 0) options_rb.set_selected_index(sr ^ 3);
sr = options_rc.selected_index();
if (sr > 0) options_rc.set_selected_index(sr ^ 3);
void XylosView::start_tx() {
upd_message();
audio::headphone::set_volume(volume_t::decibel(90 - 99) + audio::headphone::volume_range().max);
@ -215,18 +197,6 @@ XylosView::XylosView(
NavigationView& nav
)
{
static constexpr Style style_val {
.font = font::fixed_8x16,
.background = Color::green(),
.foreground = Color::black(),
};
static constexpr Style style_cancel {
.font = font::fixed_8x16,
.background = Color::red(),
.foreground = Color::black(),
};
transmitter_model.set_baseband_configuration({
.mode = 2,
.sampling_rate = 1536000,
@ -234,7 +204,7 @@ XylosView::XylosView(
});
add_children({ {
&text_title,
&checkbox_hinc,
&button_txtest,
&text_header,
&header_code_a,
@ -251,17 +221,17 @@ XylosView::XylosView(
&checkbox_wcid,
&text_freq,
&options_freq,
&text_ra,
&text_relais,
&options_ra,
&text_rb,
&options_rb,
&text_rc,
&options_rc,
&text_progress,
&text_debug,
&options_rd,
&progress,
&text_message,
&button_transmit,
&checkbox_cligno,
&button_exit
&tempo_cligno,
&text_cligno
} });
city_code.set_value(18);
@ -271,6 +241,9 @@ XylosView::XylosView(
header_code_a.set_value(0);
header_code_b.set_value(0);
options_freq.set_selected_index(5);
tempo_cligno.set_value(5);
options_ra.set_selected_index(1); // R1 OFF
checkbox_wcsubfamily.set_value(true);
checkbox_wcid.set_value(true);
@ -299,20 +272,34 @@ XylosView::XylosView(
(void)v;
XylosView::upd_message();
};
subfamily_code.hidden(true);
text_subfamily.set_style(&style_grey);
checkbox_wcsubfamily.on_select = [this](Checkbox&) {
if (checkbox_wcsubfamily.value() == true)
if (checkbox_wcsubfamily.value() == true) {
subfamily_code.hidden(true);
else
text_subfamily.set_style(&style_grey);
} else {
subfamily_code.hidden(false);
text_subfamily.set_style(&style());
}
XylosView::upd_message();
};
receiver_code.hidden(true);
text_receiver.set_style(&style_grey);
checkbox_wcid.on_select = [this](Checkbox&) {
if (checkbox_wcid.value() == true)
if (checkbox_wcid.value() == true) {
receiver_code.hidden(true);
else
text_receiver.set_style(&style_grey);
} else {
receiver_code.hidden(false);
text_receiver.set_style(&style());
}
receiver_code.set_dirty();
XylosView::upd_message();
};
options_ra.on_change = [this](size_t n, OptionsField::value_t v) {
(void)n;
(void)v;
@ -328,13 +315,18 @@ XylosView::XylosView(
(void)v;
XylosView::upd_message();
};
options_rd.on_change = [this](size_t n, OptionsField::value_t v) {
(void)n;
(void)v;
XylosView::upd_message();
};
button_transmit.set_style(&style_val);
XylosView::upd_message();
button_txtest.on_select = [this](Button&) {
const uint8_t ccirtest[21] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,13,12,11,0xFF };
const uint8_t ccirtest[21] = { 11, 13, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 14, 12, 10, 12, 14, 0, 9, 0xFF };
if (txing == false) {
EventDispatcher::message_map().unregister_handler(Message::ID::TXDone);
@ -345,8 +337,8 @@ XylosView::XylosView(
audio::headphone::set_volume(volume_t::decibel(0 - 99) + audio::headphone::volume_range().max);
transmitter_model.disable();
txing = false;
button_txtest.set_style(&style_val);
button_txtest.set_text("TX TEST");
button_txtest.set_style(&style());
button_txtest.set_text("TEST");
}
}
);
@ -367,36 +359,65 @@ XylosView::XylosView(
};
button_transmit.on_select = [this](Button&) {
if (txing == false) {
upd_message();
if (checkbox_hinc.value())
inc_cnt = 3;
else
inc_cnt = 0;
header_init = header_code_b.value();
EventDispatcher::message_map().unregister_handler(Message::ID::TXDone);
EventDispatcher::message_map().register_handler(Message::ID::TXDone,
[this](Message* const p) {
uint8_t c;
char progress[21];
uint8_t sr;
const auto message = static_cast<const TXDoneMessage*>(p);
if (message->n == 25) {
audio::headphone::set_volume(volume_t::decibel(0 - 99) + audio::headphone::volume_range().max);
transmitter_model.disable();
for (c=0;c<20;c++)
progress[c] = ' ';
progress[20] = 0;
text_progress.set(progress);
if (checkbox_cligno.value() == false) {
txing = false;
button_transmit.set_style(&style_val);
button_transmit.set_text("START");
progress.set_value(0);
if (inc_cnt) {
chThdSleepMilliseconds(1000);
header_code_b.set_value(header_code_b.value() + 1);
upd_message();
start_tx();
inc_cnt--;
} else {
journuit();
header_code_b.set_value(header_init);
if (checkbox_cligno.value() == false) {
txing = false;
button_transmit.set_style(&style_val);
button_transmit.set_text("START");
} else {
if (checkbox_hinc.value())
inc_cnt = 3;
else
inc_cnt = 0;
chThdSleepMilliseconds(tempo_cligno.value() * 1000);
// Invert relay states
sr = options_ra.selected_index();
if (sr > 0) options_ra.set_selected_index(sr ^ 3);
sr = options_rb.selected_index();
if (sr > 0) options_rb.set_selected_index(sr ^ 3);
sr = options_rc.selected_index();
if (sr > 0) options_rc.set_selected_index(sr ^ 3);
sr = options_rd.selected_index();
if (sr > 0) options_rd.set_selected_index(sr ^ 3);
upd_message();
start_tx();
}
}
} else {
for (c=0;c<message->n;c++) // Todo: Use progressbar !
progress[c] = ' ';
progress[c] = '.';
progress[++c] = 0;
text_progress.set(progress);
progress.set_value((message->n + 1) * 5);
}
}
);
@ -414,10 +435,6 @@ XylosView::XylosView(
transmitter_model.enable();
}
};
button_exit.on_select = [&nav](Button&){
nav.pop();
};
}

View file

@ -26,6 +26,11 @@
#include "ui_menu.hpp"
#include "ui_navigation.hpp"
#include "ui_font_fixed_8x16.hpp"
#include "bulb_on_bmp.hpp"
#include "bulb_off_bmp.hpp"
#include "bulb_ignore_bmp.hpp"
#include "clock_manager.hpp"
#include "message.hpp"
#include "rf_path.hpp"
@ -36,6 +41,7 @@
namespace ui {
/*
#define XYLOS_VOICE_ZERO 0
#define XYLOS_VOICE_HEADER 16
#define XYLOS_VOICE_RELAYS 21
@ -134,47 +140,61 @@ private:
{ 21 * 8, 16 * 16, 64, 32 },
"Exit"
};
};
};*/
class XylosView : public View {
public:
XylosView(NavigationView& nav);
~XylosView();
void journuit();
std::string title() const override { return "Xylos transmit"; };
void talk();
void start_tx();
void upd_message();
void focus() override;
void paint(Painter& painter) override;
private:
int inc_cnt;
int header_init;
bool txing = false;
const rf::Frequency xylos_freqs[7] = { 31325000, 31387500, 31437500, 31475000, 31687500, 31975000, 88000000 };
char ccirmessage[21];
Text text_title {
{ 8, 8, 11, 16 },
"BH Xylos TX"
const Style style_val {
.font = font::fixed_8x16,
.background = Color::green(),
.foreground = Color::black(),
};
const Style style_cancel {
.font = font::fixed_8x16,
.background = Color::red(),
.foreground = Color::black(),
};
const Style style_grey {
.font = font::fixed_8x16,
.background = Color::black(),
.foreground = Color::grey(),
};
Button button_txtest {
{ 180, 8, 40, 24 },
"TEST"
Checkbox checkbox_hinc {
{ 21 * 8, 12},
2,
"+3"
};
Text text_header {
{ 8 * 8, 2 * 16, 7 * 8, 16 },
{ 8 * 8, 1 * 16, 7 * 8, 16 },
"Header:"
};
NumberField header_code_a {
{ 16 * 8, 2 * 16 },
{ 16 * 8, 1 * 16 },
2,
{ 0, 99 },
1,
'0'
};
NumberField header_code_b {
{ 18 * 8, 2 * 16 },
{ 18 * 8, 1 * 16 },
2,
{ 0, 99 },
1,
@ -182,11 +202,11 @@ private:
};
Text text_city {
{ 4 * 8, 3 * 16, 11 * 8, 16 },
{ 4 * 8, 2 * 16, 11 * 8, 16 },
"Code ville:"
};
NumberField city_code {
{ 16 * 8, 3 * 16 },
{ 16 * 8, 2 * 16 },
2,
{ 0, 99 },
1,
@ -194,57 +214,57 @@ private:
};
Text text_family {
{ 7 * 8, 4 * 16, 8 * 8, 16 },
{ 7 * 8, 3 * 16, 8 * 8, 16 },
"Famille:"
};
NumberField family_code {
{ 16 * 8, 4 * 16 },
2,
{ 16 * 8, 3 * 16 },
1,
{ 0, 9 },
1,
' '
};
Text text_subfamily {
{ 2 * 8, 5 * 16 + 4, 13 * 8, 16 },
{ 2 * 8, 4 * 16 + 4, 13 * 8, 16 },
"Sous-famille:"
};
NumberField subfamily_code {
{ 16 * 8, 5 * 16 + 4 },
2,
{ 16 * 8, 4 * 16 + 4 },
1,
{ 0, 9 },
1,
' '
};
Checkbox checkbox_wcsubfamily {
{ 20 * 8, 5 * 16},
{ 20 * 8, 4 * 16},
6,
"Toutes"
};
Text text_receiver {
{ 2 * 8, 7 * 16 + 6, 13 * 8, 16 },
{ 2 * 8, 6 * 16, 13 * 8, 16 },
"ID recepteur:"
};
NumberField receiver_code {
{ 16 * 8, 7 * 16 + 6 },
{ 16 * 8, 6 * 16 },
2,
{ 0, 99 },
1,
' '
};
Checkbox checkbox_wcid {
{ 20 * 8, 7 * 16 + 4},
{ 20 * 8, 6 * 16 },
4,
"Tous"
};
Text text_freq {
{ 5 * 8, 9 * 16, 10 * 8, 16 },
{ 6 * 8, 8 * 16, 10 * 8, 16 },
"Frequence:"
};
OptionsField options_freq {
{ 16 * 8, 9 * 16 + 4},
{ 17 * 8, 8 * 16},
7,
{
{ "31.3250", 0 },
@ -257,51 +277,48 @@ private:
}
};
Text text_ra {
{ 12, 11 * 16, 8 * 8, 16 },
"Relais 1"
Text text_relais {
{ 8, 9 * 16 + 4, 7 * 8, 16 },
"Relais:"
};
OptionsField options_ra {
{ 16, 12 * 16 },
3,
ImageOptionsField options_ra {
{ 26, 166, 24, 24 },
{
{ "Ignorer", 0 },
{ " OFF ", 1 },
{ " ON ", 2 }
{ &bulb_ignore_bmp[0], 0 },
{ &bulb_off_bmp[0], 1 },
{ &bulb_on_bmp[0], 2 }
}
};
Text text_rb {
{ 88, 11 * 16, 8 * 8, 16 },
"Relais 2"
};
OptionsField options_rb {
{ 92, 12 * 16 },
3,
ImageOptionsField options_rb {
{ 79, 166, 24, 24 },
{
{ "Ignorer", 0 },
{ " OFF ", 1 },
{ " ON ", 2 }
{ &bulb_ignore_bmp[0], 0 },
{ &bulb_off_bmp[0], 1 },
{ &bulb_on_bmp[0], 2 }
}
};
Text text_rc {
{ 164, 11 * 16, 8 * 8, 16 },
"Relais 3"
};
OptionsField options_rc {
{ 168, 12 * 16 },
3,
ImageOptionsField options_rc {
{ 133, 166, 24, 24 },
{
{ "Ignorer", 0 },
{ " OFF ", 1 },
{ " ON ", 2 }
{ &bulb_ignore_bmp[0], 0 },
{ &bulb_off_bmp[0], 1 },
{ &bulb_on_bmp[0], 2 }
}
};
ImageOptionsField options_rd {
{ 186, 166, 24, 24 },
{
{ &bulb_ignore_bmp[0], 0 },
{ &bulb_off_bmp[0], 1 },
{ &bulb_on_bmp[0], 2 }
}
};
Text text_progress {
ProgressBar progress {
{ 5 * 8, 13 * 16, 20 * 8, 16 },
" "
};
Text text_debug {
Text text_message {
{ 5 * 8, 14 * 16, 20 * 8, 16 },
"--------------------"
};
@ -312,14 +329,25 @@ private:
};
Checkbox checkbox_cligno {
{ 96, 16 * 16 + 4},
{ 96, 16 * 16},
3,
"J/N"
};
NumberField tempo_cligno {
{ 104, 16 * 16 + 28 },
2,
{ 1, 99 },
1,
' '
};
Text text_cligno {
{ 104 + 16, 16 * 16 + 28, 2 * 8, 16 },
"s."
};
Button button_exit {
{ 21 * 8, 16 * 16, 64, 32 },
"Exit"
Button button_txtest {
{ 20 * 8, 16 * 16, 64, 32 },
"TEST"
};
};