From 07917fe5ba4f08177ddf4a0e402ac409ec4fb5fd Mon Sep 17 00:00:00 2001 From: kazu Date: Sun, 17 Jul 2022 14:47:21 +0200 Subject: [PATCH] dunno, changes and stuff --- .gitignore | 1 + Debug.h | 19 +- Platforms.h | 29 +- data/Color.h | 6 +- ext/led/WS2812B.h | 200 ++++++-------- ext/led/WS2812B_v2.h | 228 +++++++++++++++ io/GPIO.h | 82 ++++++ io/fastGPIO.h | 6 +- io/teensy/I2SBaseDMA.h | 1 + net/IP.h | 51 +++- net/UDP.h | 107 +++++--- net/WiFiRaw.h | 12 +- tools/PixelFontGen/FontBuilder.h | 333 ++++++++++++++++++++++ tools/PixelFontGen/MainWindow.cpp | 125 +++++++++ tools/PixelFontGen/MainWindow.h | 25 ++ tools/PixelFontGen/MainWindow.ui | 24 ++ tools/PixelFontGen/PixelFontGen.pro | 43 +++ tools/PixelFontGen/PixelFontGen.pro.user | 335 +++++++++++++++++++++++ tools/PixelFontGen/main.cpp | 14 + 19 files changed, 1449 insertions(+), 192 deletions(-) create mode 100644 ext/led/WS2812B_v2.h create mode 100644 tools/PixelFontGen/FontBuilder.h create mode 100644 tools/PixelFontGen/MainWindow.cpp create mode 100644 tools/PixelFontGen/MainWindow.h create mode 100644 tools/PixelFontGen/MainWindow.ui create mode 100644 tools/PixelFontGen/PixelFontGen.pro create mode 100644 tools/PixelFontGen/PixelFontGen.pro.user create mode 100644 tools/PixelFontGen/main.cpp diff --git a/.gitignore b/.gitignore index 3bcb8cc..76a2fbf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.pdf *.PDF *.tar.gz +*.ttf build-* a.out diff --git a/Debug.h b/Debug.h index 3ca3199..c1dd06d 100644 --- a/Debug.h +++ b/Debug.h @@ -62,11 +62,12 @@ private: #if IS_DESKTOP printf(buf); - #elif TEENSY + #elif IS_TEENSY Serial.print(buf); - #elif ESP8266 - os_printf(buf); - #elif ESP32 + #elif IS_ESP8266 + //os_printf(buf); + printf(buf); + #elif IS_ESP32 printf(buf); #else #error "unsupported platform" @@ -82,7 +83,7 @@ private: }; - +/* #if (!defined(DEBUG)) // #define debug(str) @@ -101,7 +102,8 @@ private: // #warning "not using debug output" -#elif ESP8266 + +#elif IS_ESP8266 #define debug(str) os_printf(str) #define debugMod(module, str) os_printf("[%s] %s\n", module, str) @@ -124,7 +126,7 @@ private: os_printf("\n"); } -#elif ESP32 +#elif IS_ESP32 #ifndef CONFIG_LOG_DEFAULT_LEVEL #define CONFIG_LOG_DEFAULT_LEVEL 3 @@ -144,7 +146,7 @@ private: #define IF_DEBUG(a) a #define debugShow(buf, len) hexdump(buf,len) -#elif TEENSY +#elif IS_TEENSY #define debugMod(module, str) {char buf[64]; sprintf(buf, "i[%-10s] ", module); Serial.print(buf); Serial.println(str);} #define debugMod1(module, str, v1) {char buf[64]; sprintf(buf, "i[%-10s] ", module); Serial.print(buf); sprintf(buf, str, v1); Serial.println(buf);} @@ -162,5 +164,6 @@ private: #error "unsupported platform" #endif +*/ #endif // DEBUG_H diff --git a/Platforms.h b/Platforms.h index 4a1d327..fe96241 100644 --- a/Platforms.h +++ b/Platforms.h @@ -25,24 +25,24 @@ #if (IS_ESP32) - #pragma message "Using ESP32" + //#pragma message "Using ESP32" #define DELAY_US(us) ets_delay_us(us) #define IN_FLASH #elif (IS_ESP8266) - #pragma message "Using ESP8266" + //#pragma message "Using ESP8266" #define DELAY_US(us) os_delay_us(us) #define IN_FLASH ICACHE_FLASH_ATTR #elif (IS_TEENSY) - #pragma message "Using Teensy" + //#pragma message "Using Teensy" #define DELAY_MS(ms) delay(ms) #elif (IS_DESKTOP) - #pragma message "Using Desktop" + //#pragma message "Using Desktop" #define DELAY_MS(ms) delay(ms) #else @@ -62,21 +62,22 @@ // return (a>b) ? (a) : (b); //} -#if ESP8266 +#if IS_ESP8266 #define sprintf os_sprintf - extern "C" { - #include "ets_sys.h" - #include "c_types.h" - #include "osapi.h" - #include "user_interface.h" - #include "mem.h" - #include "espconn.h" + extern "C" { +// #include "ets_sys.h" +// #include "c_types.h" +// #include "osapi.h" +// #include "user_interface.h" +// #include "mem.h" +// #include "espconn.h" + #include "esp_system.h" } -#elif ESP32 +#elif IS_ESP32 #include #include #endif -#if TEENSY +#if IS_TEENSY #define IRAM_ATTR #endif diff --git a/data/Color.h b/data/Color.h index 6fe0fba..2c93f75 100644 --- a/data/Color.h +++ b/data/Color.h @@ -1,5 +1,5 @@ -#ifndef COLOR_H -#define COLOR_H +#ifndef ESP_COLOR_H +#define ESP_COLOR_H #include @@ -113,4 +113,4 @@ public: }; -#endif // COLOR_H +#endif // ESP_COLOR_H diff --git a/ext/led/WS2812B.h b/ext/led/WS2812B.h index 0f0e9b5..a3d3586 100644 --- a/ext/led/WS2812B.h +++ b/ext/led/WS2812B.h @@ -6,19 +6,22 @@ #include "../../Debug.h" #include "../../io/GPIO.h" +#include -#if ESP8266 +#if IS_ESP8266 - #include "../../io/fastGPIO.h" + // https://github.com/FastLED/FastLED/tree/master/src/platforms/esp/8266 + + #include "../../io/GPIO.h" template class WS2812B { static constexpr const char* NAME = "WS2812B"; - #define LED_SET_PIN_TO_OUTPUT GPIO5_OUTPUT_SET - #define LED_SET_PIN_H GPIO5_H - #define LED_SET_PIN_L GPIO5_L + #define LED_SET_PIN_TO_OUTPUT MyGPIO::setOutput(5) //GPIO5_OUTPUT_SET + #define LED_SET_PIN_H MyGPIO::set(5) //GPIO5_H + #define LED_SET_PIN_L MyGPIO::clear(5) //GPIO5_L //#define NS_PER_TICK ( (1000ul*1000ul*1000ul) / (80ul*1000ul*1000ul) ) @@ -37,7 +40,7 @@ void init() { LED_SET_PIN_TO_OUTPUT; - debugMod1(NAME, "init with %d leds", numLEDs); + Log::addInfo(NAME, "init with %d leds", numLEDs); } /** set the color for the given LED */ @@ -74,12 +77,16 @@ } /** flush configured changes */ - void flush() { + IRAM_ATTR void flush() { - LED_SET_PIN_TO_OUTPUT; - - ets_intr_lock(); + //LED_SET_PIN_TO_OUTPUT; + //ets_intr_lock(); + //taskENTER_CRITICAL(); + //taskDISABLE_INTERRUPTS(); + //const uint32_t saved = XTOS_DISABLE_ALL_INTERRUPTS; + vPortETSIntrLock(); + // process each LED for (int i = 0; i < numLEDs; ++i) { @@ -97,19 +104,29 @@ } - ets_intr_unlock(); - + //ets_intr_unlock(); + //taskEXIT_CRITICAL(); + //XTOS_RESTORE_INTLEVEL(saved); + vPortETSIntrUnlock(); + //taskENABLE_INTERRUPTS(); + reset(); + + } /** flush configured changes, including global brightness */ - void flushBrightness(const uint8_t brightness) { + IRAM_ATTR void flushBrightness(const uint8_t brightness) { - LED_SET_PIN_TO_OUTPUT; - - ets_intr_lock(); + //LED_SET_PIN_TO_OUTPUT; + //ets_intr_lock(); + //taskENTER_CRITICAL(); + taskDISABLE_INTERRUPTS(); + //const uint32_t saved = XTOS_DISABLE_ALL_INTERRUPTS; + //vPortETSIntrLock(); + // process each LED for (int i = 0; i < numLEDs; ++i) { @@ -127,122 +144,79 @@ } - ets_intr_unlock(); - + //ets_intr_unlock(); + taskENABLE_INTERRUPTS(); + //taskEXIT_CRITICAL(); + //XTOS_RESTORE_INTLEVEL(saved); + //vPortETSIntrUnlock(); + reset(); } private: - inline void sendByte(uint8_t b) { - // for (uint8_t i = 0; i < 8; ++i) { - // if (b & 0b10000000) { - // send1(); - // } else { - // send0(); - // } - // b <<= 1; - // } - if (b & 0b10000000) {send1();} else {send0();} - if (b & 0b01000000) {send1();} else {send0();} - if (b & 0b00100000) {send1();} else {send0();} - if (b & 0b00010000) {send1();} else {send0();} - if (b & 0b00001000) {send1();} else {send0();} - if (b & 0b00000100) {send1();} else {send0();} - if (b & 0b00000010) {send1();} else {send0();} - if (b & 0b00000001) {send1();} else {send0();} + IRAM_ATTR void sendByte(uint8_t b) { + //if (b & 0b10000000) {send1();} else {send0();} + //if (b & 0b01000000) {send1();} else {send0();} + //if (b & 0b00100000) {send1();} else {send0();} + //if (b & 0b00010000) {send1();} else {send0();} + //if (b & 0b00001000) {send1();} else {send0();} + //if (b & 0b00000100) {send1();} else {send0();} + //if (b & 0b00000010) {send1();} else {send0();} + //if (b & 0b00000001) {send1();} else {send0();} + for (uint8_t i = 0; i < 8; ++i) { + if (b & 0b10000000) {send1();} else {send0();} + b <<= 1; + } } - __attribute__((always_inline)) inline void send1() { // 800ns high, 450ns low + // @80 MHz one instruction = 12.5ns + // @160 MHz one instruction = 6.25ns + + __attribute__((always_inline)) void send1() { // 800ns high, 450ns low LED_SET_PIN_H; - delay800(); + delayL(); LED_SET_PIN_L; - delay100(); + delayS(); + //const uint32_t tmp = soc_get_ccount(); + //LED_SET_PIN_H; + //while(soc_get_ccount() - tmp < 144) {} + //LED_SET_PIN_L; + //while(soc_get_ccount() - tmp < 192-24) {} } - __attribute__((always_inline)) inline void send0() { // 400ns high, 850ns low + __attribute__((always_inline)) void send0() { // 400ns high, 850ns low LED_SET_PIN_H; - delay100(); + delayS(); LED_SET_PIN_L; - delay800(); + delayL(); + //const uint32_t tmp = soc_get_ccount(); + //LED_SET_PIN_H; + //while(soc_get_ccount() - tmp < 48) {} + //LED_SET_PIN_L; + //while(soc_get_ccount() - tmp < 192-24) {} } - __attribute__((always_inline)) inline void reset() { - LED_SET_PIN_L; - os_delay_us(50); + __attribute__((always_inline)) void reset() { + LED_SET_PIN_L; // low for more than 50 us + //const uint32_t tmp = soc_get_ccount(); + //while(soc_get_ccount() - tmp < 9999) {} + //os_delay_us(100); + //LED_SET_PIN_H; + //asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop"); + //LED_SET_PIN_L; //delayMicroseconds(50); } - - - //#pragma GCC optimize 0 - - __attribute__((always_inline)) inline void delay50() { - asm volatile("nop"); - asm volatile("nop"); - asm volatile("nop"); - asm volatile("nop"); + + __attribute__((always_inline)) void delayS() { + for(uint8_t i = 0; i < (9*1); ++i) {asm("nop");} } - - - // 100 ns delay. @80 MHz one nop = 12,5ns - __attribute__((always_inline)) inline void delay100() { - delay50(); - delay50(); + + __attribute__((always_inline)) void delayL() { + for(uint8_t i = 0; i < (9*2); ++i) {asm("nop");} } - /* - __attribute__((always_inline)) inline void delay200() { - delay100(); - delay100(); - } - - __attribute__((always_inline)) inline void delay400() { - delay100(); - delay100(); - delay100(); - delay100(); - } - - __attribute__((always_inline)) inline void delay500() { - delay100(); - delay100(); - delay100(); - delay100(); - delay100(); - } - - __attribute__((always_inline)) inline void delay600() { - delay100(); - delay100(); - delay100(); - delay100(); - delay100(); - delay100(); - } - */ - - __attribute__((always_inline)) inline void delay800() { - delay100(); - delay100(); - delay100(); - delay100(); - delay100(); - delay100(); - delay100(); - delay100(); - } - - - // #pragma GCC reset_options - - - - // inline void delayNS(const uint16_t ns) { - // const uint16_t ticks = ns / NS_PER_TICK / 2; - // for (uint16_t i = 0; i < ticks; ++i) {asm("nop");} - // } - }; #elif false// ESP32aaa @@ -452,7 +426,7 @@ }; -#elif ESP32 +#elif IS_ESP32 #include "../../io/I2S.h" @@ -474,7 +448,7 @@ } void init() { - debugMod1(TAG, "init with %d leds", NUM_LEDS); + Log::addInfo(TAG, "init with %d leds", NUM_LEDS); cfg(); } diff --git a/ext/led/WS2812B_v2.h b/ext/led/WS2812B_v2.h new file mode 100644 index 0000000..ff09e3b --- /dev/null +++ b/ext/led/WS2812B_v2.h @@ -0,0 +1,228 @@ +#ifndef WS2812B_H +#define WS2812B_H + +#include "../../data/Color.h" +#include "../../Platforms.h" +#include "../../Debug.h" +#include "../../io/GPIO.h" + +#include + + +#if IS_ESP8266 + + // https://github.com/FastLED/FastLED/tree/master/src/platforms/esp/8266 + + //#include "../../io/fastGPIO.h" + #include "../../io/GPIO.h" + #include "driver/i2s.h" + #include + + template class WS2812B { + + static constexpr const char* NAME = "WS2812B"; + + #define LED_SET_PIN_TO_OUTPUT MyGPIO::setOutput(5) //GPIO5_OUTPUT_SET + #define LED_SET_PIN_H MyGPIO::set(5) //GPIO5_H + #define LED_SET_PIN_L MyGPIO::clear(5) //GPIO5_L + + //#define NS_PER_TICK ( (1000ul*1000ul*1000ul) / (80ul*1000ul*1000ul) ) + + /** color-value for each attached LED */ + Color colors[numLEDs]; + + /** enable/disable each led */ + bool enabled[numLEDs] = {true}; + + static constexpr const int bits = 16; + static constexpr const i2s_port_t I2S_NUM = (i2s_port_t)0; + static constexpr const int SAMPLE_RATE = 44100; // 100000 + + class SendBuffer { + + uint32_t buf[numLEDs * 3 + 32]; + int idx = 0; + + i2s_config_t i2s_config; + i2s_pin_config_t pin_config; + + public: + + SendBuffer() { + + } + + void init() { + + Log::addInfo("i2s", "init()"); + memset(&i2s_config, 0, sizeof(i2s_config)); + i2s_config.mode = (i2s_mode_t) (I2S_MODE_MASTER | I2S_MODE_TX); // Only TX + i2s_config.sample_rate = SAMPLE_RATE; + i2s_config.bits_per_sample = (i2s_bits_per_sample_t)16; // 16 bit + i2s_config.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT; // 2-channels + i2s_config.communication_format = (i2s_comm_format_t) (I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB); + i2s_config.dma_buf_count = 6; + i2s_config.dma_buf_len = 256; + + memset(&pin_config, 0, sizeof(pin_config)); + pin_config.bck_o_en = 1; + pin_config.ws_o_en = 2; + pin_config.data_out_en = 15; // 5 + + ESP_ERROR_CHECK(i2s_driver_install(I2S_NUM, &i2s_config, 0, nullptr)); + ESP_ERROR_CHECK(i2s_set_pin(I2S_NUM, &pin_config)); + //ESP_ERROR_CHECK(i2s_set_clk(I2S_NUM, SAMPLE_RATE, (i2s_bits_per_sample_t)16, (i2s_channel_t)2)); + + } + + + void reset() { + idx = 0; + } + + void add(uint8_t b) { + buf[idx] = encode(b); + ++idx; + } + + void transmit() { + + size_t written = 0; + size_t bytes = 512;//sizeof(uint32_t) * idx + 20+512; + ESP_ERROR_CHECK(i2s_write(I2S_NUM, buf, bytes, &written, 100)); + Log::addInfo("I2s", "transmit %d %d", bytes, written); + } + + /** byte -> i2s transmission pattern */ + uint32_t encode(uint8_t b) { + + #define _LO 0b1000 + #define _HI 0b1110 + uint32_t res; + uint8_t* tmp = (uint8_t*) &res; + tmp[0] = (((b & (1<<7)) ? (_HI) : (_LO)) << 4) | (((b & (1<<6)) ? (_HI) : (_LO)) << 0); + tmp[1] = (((b & (1<<5)) ? (_HI) : (_LO)) << 4) | (((b & (1<<4)) ? (_HI) : (_LO)) << 0); + tmp[2] = (((b & (1<<3)) ? (_HI) : (_LO)) << 4) | (((b & (1<<2)) ? (_HI) : (_LO)) << 0); + tmp[3] = (((b & (1<<1)) ? (_HI) : (_LO)) << 4) | (((b & (1<<0)) ? (_HI) : (_LO)) << 0); + return res; + + } + + } sendBuf; + + + + + public: + + /** ctor */ + WS2812B() { + init(); + } + + void init() { + LED_SET_PIN_TO_OUTPUT; + Log::addInfo(NAME, "init with %d leds", numLEDs); + } + + void init2() { + sendBuf.init(); + } + + /** set the color for the given LED */ + void setColor(const uint8_t idx, const Color rgb) { + colors[idx] = rgb; + } + + /** set the color for all LEDs */ + void setColor(const Color rgb) { + for (int idx = 0; idx < numLEDs; ++idx) { + colors[idx] = rgb; + } + } + + /** enable/disable the given LED */ + void setEnabled(const uint8_t idx, const bool en) { + enabled[idx] = en; + } + + /** enable/disable all LEDs */ + void setEnabled(const bool en) { + for (int idx = 0; idx < numLEDs; ++idx) { + enabled[idx] = en; + } + } + + /** is the given LED enabled? */ + bool isEnabled(const uint8_t idx) const { + return enabled[idx]; + } + + Color& getColor(const uint8_t idx) { + return colors[idx]; + } + + + + + + + /** flush configured changes */ + IRAM_ATTR void flush() { + + sendBuf.reset(); + + // process each LED + for (uint16_t i = 0; i < numLEDs; ++i) { + + // send each LEDs 24-bit GRB data + if (enabled[i]) { + const Color rgb = colors[i]; + sendBuf.add(rgb.g); + sendBuf.add(rgb.r); + sendBuf.add(rgb.b); + } else { + sendBuf.add(0); + sendBuf.add(0); + sendBuf.add(0); + } + + } + + sendBuf.transmit(); + + } + + /** flush configured changes, including global brightness */ + IRAM_ATTR void flushBrightness(const uint8_t brightness) { + + sendBuf.reset(); + + // process each LED + for (uint16_t i = 0; i < numLEDs; ++i) { + + // send each LEDs 24-bit GRB data + if (enabled[i]) { + const Color rgb = colors[i].brightness(brightness); + sendBuf.add(rgb.g); + sendBuf.add(rgb.r); + sendBuf.add(rgb.b); + } else { + sendBuf.add(0); + sendBuf.add(0); + sendBuf.add(0); + } + + } + + sendBuf.transmit(); + + } + + + + }; + +#endif + +#endif // WS2812B_H diff --git a/io/GPIO.h b/io/GPIO.h index 0ca881e..385cce7 100644 --- a/io/GPIO.h +++ b/io/GPIO.h @@ -6,6 +6,8 @@ #if IS_ESP8266 + +/* #include "fastGPIO.h" struct MyGPIO { @@ -93,6 +95,86 @@ } }; +*/ + + #include "driver/gpio.h" + #include "esp8266/gpio_struct.h" + + struct MyGPIO { + + static inline bool get(const uint8_t num) { + return get((gpio_num_t)num); + } + static inline bool get(const gpio_num_t num) { + return gpio_get_level(num); // TODO faster access like READ_PERI_REG?? + } + + template static inline void setOrClear(const uint8_t num, const T val) { + if (val) {set(num);} else {clear(num);} + //WRITE_PERI_REG(GPIO_OUT_W1TS_REG, (val != 0) << num); // branchless but usually slower + //WRITE_PERI_REG(GPIO_OUT_W1TC_REG, (val == 0) << num); + } + + __attribute__((always_inline)) static inline void set(const uint8_t num) { + //gpio_set_level((gpio_num_t)num, 1); // TODO: faster + GPIO.out_w1ts |= (0x1 << num); + } + + __attribute__((always_inline)) static inline void clear(const uint8_t num) { + //gpio_set_level((gpio_num_t)num, 0); // TODO: faster + GPIO.out_w1tc |= (0x1 << num); + } + + static inline void setOutput(const uint8_t num) { + setOutput((gpio_num_t)num); + } + static inline void setOutput(const gpio_num_t num) { + //gpio_set_direction(num, GPIO_MODE_OUTPUT); // does not always suffice?! + gpio_config_t io_conf; + io_conf.intr_type = GPIO_INTR_DISABLE; + io_conf.mode = GPIO_MODE_OUTPUT; + io_conf.pin_bit_mask = (1< +#include /** * base-class for I2S1 and I2S2 when using DMA diff --git a/net/IP.h b/net/IP.h index f8f0687..9be3ae9 100644 --- a/net/IP.h +++ b/net/IP.h @@ -5,7 +5,8 @@ #define Port uint16_t -#if ESP8266 + +#if OLD_IS_ESP8266 // RAW struct IP4 { @@ -13,17 +14,17 @@ ip_addr_t addr; /** empty ctor */ - explicit IP4() { + explicit IP4() { addr.addr = 0; } /** ctor with IP-string */ - explicit IP4(const char* ipStr) { + explicit IP4(const char* ipStr) { set(ipStr); } /** ctor with ip_addr_t */ - explicit IP4(ip_addr addr) : addr(addr) { + explicit IP4(ip_addr addr) : addr(addr) { ; } @@ -47,7 +48,47 @@ }; -#elif ESP32 +#elif IS_ESP8266 // freeRTOS + + #include + + struct IP4 { + + ip4_addr addr; + + /** empty ctor */ + explicit IP4() { + addr.addr = 0; + } + + /** ctor with IP-string */ + explicit IP4(const char* ipStr) { + set(ipStr); + } + + /** ctor with ip4_addr */ + explicit IP4(ip4_addr _addr) { + addr =_addr; + } + + /** set the IP by string: x.x.x.x */ + void set(const char* ipStr) { + ip4addr_aton(ipStr, &addr); + } + + /** convert to ip_addr/ip_addr_t */ + const ip_addr_t* getPtr() const { + return &addr; + } + + /** convert to string */ + const char* toString() const { + return ipaddr_ntoa(&addr); + } + + }; + +#elif IS_ESP32 #include diff --git a/net/UDP.h b/net/UDP.h index 8d22cfd..1c01f27 100644 --- a/net/UDP.h +++ b/net/UDP.h @@ -2,11 +2,16 @@ #define UDP_H extern "C" { - #include "mem.h" - #include "espconn.h" + //#include "mem.h" + //#include "espconn.h" + #include "lwip/sockets.h" + #include "lwip/sys.h" + #include "lwip/err.h" + #include "lwip/udp.h" } -typedef void (*UDPCallback)(void* arg, char* data, unsigned short len); +//typedef void (*UDPCallback)(void* arg, char* data, unsigned short len); +typedef void (*UDPCallback)(void* arg, struct udp_pcb* pcb, struct pbuf* p, const ip_addr_t* addr, u16_t port); #include "../Debug.h" #include "IP.h" @@ -17,7 +22,8 @@ private: static constexpr const char* NAME = "UDP"; - espconn* con; + //espconn* con; + struct udp_pcb* udp; public: @@ -35,78 +41,91 @@ public: /** bind the socket to the given local port */ void bind(const Port localPort) { - debugMod1(NAME, "binding to local port %d", localPort); + Log::addInfo(NAME, "binding to local port %d", localPort); - // set the local port to listen on - con->proto.udp->local_port = localPort; +// // set the local port to listen on +// con->proto.udp->local_port = localPort; +// +// // todo: check? 0=OK +// const int res = espconn_create(con); +// os_printf("create: %d\r\n", res); - // todo: check? 0=OK - const int res = espconn_create(con); - os_printf("create: %d\r\n", res); + ip_addr_t bindIP; + IP4_ADDR(&bindIP, 0,0,0,0); + udp_bind(udp, &bindIP, localPort); } bool send(const IP4 ip, const Port port, const void* data, const uint16_t dataLen) { - debugMod1(NAME, "sending packet to remote port %d", port); + Log::addInfo(NAME, "sending packet to remote port %d", port); - // set remote port and IP - con->proto.udp->remote_port = port; - os_memcpy(con->proto.udp->remote_ip, ip.getPtr(), 4); +// // set remote port and IP +// con->proto.udp->remote_port = port; +// os_memcpy(con->proto.udp->remote_ip, ip.getPtr(), 4); +// +// // send. TODO: check. 0=OK +// const int res = espconn_sent(con, (unsigned char*)data, dataLen); +// return (res == 0); - //os_printf("send %d bytes\r\n", dataLen); - //os_printf("IP: %d.%d.%d.%d\n\r", con->proto.udp->remote_ip[0], con->proto.udp->remote_ip[1], con->proto.udp->remote_ip[2], con->proto.udp->remote_ip[3]); + // allocate and fill transmit buffer + pbuf* buf = pbuf_alloc(PBUF_TRANSPORT, dataLen, PBUF_RAM); + memcpy(buf->payload, data, dataLen); - // send. TODO: check. 0=OK - const int res = espconn_sent(con, (unsigned char*)data, dataLen); - return (res == 0); + // transmit + udp_sendto(udp, buf, ip.getPtr(), port); + + pbuf_free(buf); + + return true; } /** set the callback to call whenever a packet is received */ void setRecvCallback(UDPCallback callback) { - debugMod(NAME, "setRecvCallback()"); - espconn_regist_recvcb(con, callback); + Log::addInfo(NAME, "setRecvCallback()"); +// espconn_regist_recvcb(con, callback); + udp_recv(udp, callback, this); } /** get the IP address of the most recent packet's sender */ - IP4 getSenderIP() { - - remot_info* rem; - espconn_get_connection_info(con, &rem, 0); - ip_addr_t* _ip = (ip_addr_t*) rem->remote_ip; - return IP4(*_ip); - //const uint16_t port = rem->remote_port; - - } +// IP4 getSenderIP() { +// remot_info* rem; +// espconn_get_connection_info(con, &rem, 0); +// ip_addr_t* _ip = (ip_addr_t*) rem->remote_ip; +// return IP4(*_ip); +// } private: /** initialize the UDP "connection" */ void init() { - debugMod(NAME, "init()"); + Log::addInfo(NAME, "init()"); - // allocate connection-objects - con = (espconn*) os_zalloc(sizeof(espconn)); - ets_memset( con, 0, sizeof( espconn ) ); - - // configure - con->type = ESPCONN_UDP; - //con->state = ESPCONN_NONE; - - con->proto.udp = (esp_udp*) os_zalloc(sizeof(esp_udp)); +// // allocate connection-objects +// con = (espconn*) os_zalloc(sizeof(espconn)); +// ets_memset( con, 0, sizeof( espconn ) ); +// +// // configure +// con->type = ESPCONN_UDP; +// +// con->proto.udp = (esp_udp*) os_zalloc(sizeof(esp_udp)); + udp = udp_new(); + } /** cleanup everything */ void cleanup() { - debugMod(NAME, "cleanup()"); + Log::addInfo(NAME, "cleanup()"); - espconn_delete(con); - os_free(con->proto.udp); - os_free(con); +// espconn_delete(con); +// os_free(con->proto.udp); +// os_free(con); + + udp_remove(udp); } diff --git a/net/WiFiRaw.h b/net/WiFiRaw.h index ca8011f..5569569 100644 --- a/net/WiFiRaw.h +++ b/net/WiFiRaw.h @@ -3,6 +3,12 @@ #include "MAC.h" +#if IS_ESP8266 + extern "C" { + #include "esp_wifi.h" + } +#endif + // ifconfig wlp0s26u1u2u1 down && iw dev wlp0s26u1u2u1 set monitor none && ifconfig wlp0s26u1u2u1 up && iw dev wlp0s26u1u2u1 set channel 3 // ifconfig wlp0s26u1u2u1 down && iw dev wlp0s26u1u2u1 set monitor none && ifconfig wlp0s26u1u2u1 up iwconfig wlp0s26u1u2u1 channel 3 @@ -183,15 +189,15 @@ namespace WiFiRaw { }; -#ifdef ESP8266 +#if IS_ESP8266 WiFiRaw::MACAddress getMyMAC() { WiFiRaw::MACAddress mine; - wifi_get_macaddr(0x00, (uint8_t*)&mine); + esp_wifi_get_mac(ESP_IF_WIFI_STA, (uint8_t*)&mine); return mine; } #endif -#ifdef ESP32 +#if IS_ESP32 WiFiRaw::MACAddress getMyMAC() { WiFiRaw::MACAddress mine; esp_wifi_get_mac(ESP_IF_WIFI_STA, (uint8_t*)&mine); diff --git a/tools/PixelFontGen/FontBuilder.h b/tools/PixelFontGen/FontBuilder.h new file mode 100644 index 0000000..97f20af --- /dev/null +++ b/tools/PixelFontGen/FontBuilder.h @@ -0,0 +1,333 @@ +#ifndef FONTBUILDER_H +#define FONTBUILDER_H + + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +struct FontBuilder { + + /** resulting font */ + struct Result { + + /** pixel data */ + std::vector data; + + /** character x offset in pixel */ + std::vector offsets; + + uint16_t w; + uint8_t h; + QImage img; + + void dump(const char* name) const { + + std::cout << "static const uint8_t " << name << "_data[] = {"; + for (uint8_t i : data) { + std::cout << (int) i << ","; + } + std::cout << "};" << std::endl; + + std::cout << "static const uint16_t " << name << "_offsets[] = {"; + for (uint16_t i : offsets) { + std::cout << (int) i << ","; + } + std::cout << "};" << std::endl; + + //std::cout << "out size: " << w << ":" << h << std::endl; + std::cout << "static const FontWrap fnt_" << name << "(" << (int)w << "," << (int)h << "," << name << "_data," << name << "_offsets);" << std::endl; + + std::cout << "--------------------" << std::endl; + + + } + + + }; + + + Result res; + uint16_t curX = 0; + + FontBuilder(const int h) { + + //if ( (w%8) != 0 ) { + // throw "width must be multiple of 8"; + //} + + res.w = 1024; + res.h = h; + res.img = QImage(res.w, res.h, QImage::Format_Mono); + + QPainter p(&res.img); + p.fillRect(0, 0, res.w, res.h, Qt::white); + p.end(); + + } + + void addDummy() { + // update + res.offsets.push_back(curX); + curX += 0; + } + + void addIcon(QString file, float w, float h, int atHeight) { + +// //QImage img = QIcon("filepath.svg").pixmap(QSize()).toImage(); +// QSvgRenderer renderer(file); +// QImage img(pixelSize, pixelSize, QImage::Format_ARGB32); +// //pm.fill(Qt::blue); +// QPainter painter(&img); +// painter.fillRect(0, 0, pixelSize, pixelSize, Qt::blue); +// renderer.render(&painter, img.rect()); + +// // renderer +// QPainter p(&res.img); +// p.setRenderHint(QPainter::Antialiasing, false); +// p.setRenderHint(QPainter::TextAntialiasing, false); +// //p.setPen(Qt::white); + +// // render +// p.drawImage(curX, atHeight, img); +// p.end(); + + + // renderer + QPainter p(&res.img); + p.setRenderHint(QPainter::Antialiasing, false); + p.setRenderHint(QPainter::TextAntialiasing, false); + p.setRenderHint(QPainter::SmoothPixmapTransform, false); + p.setRenderHint(QPainter::HighQualityAntialiasing, false); + + // render the image + QSvgRenderer renderer(file); + //QImage img(pixelSize, pixelSize, QImage::Format_RGB888); + QRect rect(curX, 0, w, h); + //p.fillRect(rect, Qt::blue); + renderer.render(&p, rect); + + // update + res.offsets.push_back(curX); + curX += w+1; + + } + + void addCharsMonoFromImage(QString file, const int charW, unsigned char cFirst, unsigned char cLast) { + + // renderer +// QPainter p(&res.img); +// p.setRenderHint(QPainter::Antialiasing, false); +// p.setRenderHint(QPainter::TextAntialiasing, false); + int stride = 1; + + QImage img; + img.load(file); + res.img = img; + res.w = img.width(); + res.h = img.height(); +// p.drawImage(0, 0, img); + + // draw letters + for (unsigned char c = cFirst; c < cLast; ++c) { + int x1 = (c-cFirst) * (charW+stride); + int w = charW; + int y1 = 0; + int h = res.h; + QRect rect = QRect(x1, y1, w, h); + res.offsets.push_back(curX); + curX += std::ceil(rect.width()) + 1; + } + +// p.end(); + + + } + + void addChars(QString fontFile, float pixelSize, int atHeight, unsigned char cFirst, unsigned char cLast, std::function fixFunc = nullptr) { + + + // renderer + QPainter p(&res.img); + p.setRenderHint(QPainter::Antialiasing, false); + p.setRenderHint(QPainter::TextAntialiasing, false); + p.setPen(Qt::black); + + // the font + int id = QFontDatabase::addApplicationFont(fontFile); + QString family = QFontDatabase::applicationFontFamilies(id).at(0); + QFont fnt(family); + if (pixelSize == -1) { + ; + } else if (pixelSize > 100) { + fnt.setPointSize(pixelSize-100); + } else { + fnt.setPixelSize(pixelSize); + } + + QFontMetrics fm(fnt); + + // enable + p.setFont(fnt); + + // draw letters + for (unsigned char c = cFirst; c < cLast; ++c) { + + QRect rect = fm.boundingRect(c); + QString str = ""; str += c; + + res.offsets.push_back(curX); + int drawOffsetX = 0; + + // apply rectangle fixing function? + if (fixFunc) { + + fixFunc(c, rect); + + // hack for some chars + if (rect.x() < 0) {drawOffsetX = -rect.x();} + + } + + std::cout << " " << c << " : " << rect.width() << " cur: " << curX << std::endl; + + p.drawText(curX+drawOffsetX, atHeight, str); + curX += std::ceil(rect.width()) + 1; // 1 pixel space between chars + } + + p.end(); + + } + + + const Result& get() { + + // crop image (only used region) + res.w = (curX/8+1)*8; + res.img = res.img.copy(0,0,res.w,res.h); + + + // convert to bitfield + const unsigned int bytes = res.w/8 * res.h; + res.data.resize(bytes); + for (int y = 0; y < res.h; ++y) { + for (int x = 0; x < res.w; ++x) { + const QColor pixel = res.img.pixelColor(x,y); + bool set = pixel.red() + pixel.green() + pixel.blue() == 0; + if (set) { + const unsigned int idx = (x/8) + (y*res.w/8); + res.data[idx] |= (1 << (x%8)); + } + } + } + + return res; + + } + + +/* + Result build(const QString& fontFile, int maxChar, float pixelSize, const int oh) { + + // the font + int id = QFontDatabase::addApplicationFont(fontFile); + QString family = QFontDatabase::applicationFontFamilies(id).at(0); + QFont fnt(family); fnt.setPixelSize(pixelSize); + QFontMetrics fm(fnt); + + // first chars are unused + std::vector offsets; + for (unsigned char c = 0; c <= 32; ++c) { + offsets.push_back(0); + } + + // estimate total width and remember character offsets + int mx = 0; + for (unsigned char c = 32; c < maxChar; ++c) { + QRect rect = fm.boundingRect(c); + mx += std::ceil(rect.width()) + 1; + //if (c < 128 && rect.height() > my) {my = rect.height();} + offsets.push_back(mx); + } + + // width/height + int w = mx; + int h = oh; + + // width/height next multiple of 8 + int ow = ((w-1)/8+1)*8; + //int oh = h; + + QImage img = QImage(ow, oh, QImage::Format_RGB888); + QPainter p(&img); + + p.setRenderHint(QPainter::Antialiasing, false); + p.setRenderHint(QPainter::TextAntialiasing, false); + p.setPen(Qt::white); + p.setFont(fnt); + p.fillRect(0, 0, w, h, Qt::black); + + + + + // draw image + std::vector data; + for (unsigned char c = 32; c < maxChar; ++c) { + QRect rect = fm.boundingRect(c); + QString str = ""; str += c; + int x = offsets[c]; + p.drawText(x, h, str); + } + + p.end(); + + + + + // convert to bitfield + const unsigned int bytes = ow/8 * oh; + data.resize(bytes); + for (int y = 0; y < oh; ++y) { + for (int x = 0; x < ow; ++x) { + bool set = img.pixelColor(x,y).red() > 128; + if (set) { + const unsigned int idx = (x/8) + (y*ow/8); + data[idx] |= (1 << (x%8)); + } + } + } + + + // remove initial empty offsets + offsets.erase(offsets.begin(), offsets.begin()+32); + + + //img.save("/tmp/1.png"); + + //int i = 0; (void) i; + + Result res; + res.data = data; + res.offsets = offsets; + res.w = ow; + res.h = oh; + res.img = img; + + return res; + + } + */ + +}; + +#endif // FONTBUILDER_H diff --git a/tools/PixelFontGen/MainWindow.cpp b/tools/PixelFontGen/MainWindow.cpp new file mode 100644 index 0000000..31d9705 --- /dev/null +++ b/tools/PixelFontGen/MainWindow.cpp @@ -0,0 +1,125 @@ +#include "MainWindow.h" +#include "ui_MainWindow.h" +#include +#include +#include + +#include +#include + +#include + +MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {// ui(new Ui::MainWindow) { + //ui->setupUi(this); + + setMinimumSize(1500,300); + + //QFont fnt("/apps/esp/test/04B_03__.TTF"); fnt.setPixelSize(7); + + + +} + +MainWindow::~MainWindow() { + //delete ui; +} + +void MainWindow::paintEvent(QPaintEvent* e) { + + QString fontPath="/apps/ESP8266lib/tools/PixelFontGen/fonts/"; + + //FontBuilder::Result res = fb.build("/apps/esp/test/04B_03__.TTF"); + //FontBuilder fb(10); fb.addChars("/apps/esp/PixelFont/PixelOperator.ttf", 16, 9, 32, 126); + //FontBuilder fb(8); fb.addChars("/apps/esp/PixelFont/04B_03__.TTF", 8, 6, 32, 126); // OK + //FontBuilder fb(8); fb.addChars("/apps/esp/PixelFont/Minecraft.ttf", 7.5, 6, 32, 126); // ugly + //FontBuilder fb(10); fb.addChars("/apps/esp/PixelFont/EnterCommand.ttf", 15, 8, 32, 126); + //FontBuilder fb(10); fb.addChars("/apps/esp/PixelFont/PIXELADE.TTF", 13, 8, 32, 126); + //FontBuilder fb(10); fb.addChars("/apps/esp/PixelFont/C&C Red Alert [LAN].ttf", 110, 8, 32, 126); // ugly + //FontBuilder fb(11); fb.addChars("/apps/esp/PixelFont/LeviWindows.ttf", 21, 9, 32, 126); + //FontBuilder fb(9); fb.addChars("/apps/esp/PixelFont/SadMachine.ttf", 16, 8, 32, 126); + //FontBuilder fb(7); fb.addChars("/apps/esp/PixelFont/bitdust1.ttf", 8, 6, 32, 126); // NICE + //FontBuilder fb(10); fb.addChars("/apps/esp/PixelFont/pixeljosh6.ttf", 8, 7, 32, 126); + //FontBuilder fb(9); fb.addChars("/apps/esp/PixelFont/BitPotionExt.ttf", 16, 7, 32, 126); + //FontBuilder fb(10); fb.addChars("/apps/esp/PixelFont/PIXEARG_.TTF", 8, 8, 32, 126); + //FontBuilder fb(10); fb.addChars(fontPath+"/Volter__28Goldfish_29.ttf", 9, 8, 32, 126); + //FontBuilder fb(10); fb.addChars(fontPath+"/ti-83-plus-large.ttf", 8, 8, 32, 126); + //FontBuilder fb(10); fb.addChars(fontPath+"/EXEPixelPerfect.ttf", 16, 8, 32, 126); + //FontBuilder fb(10); fb.addChars(fontPath+"/new-gen.ttf", 9, 8, 32, 126); + //FontBuilder fb(10); fb.addChars(fontPath+"/Comicoro.ttf", 16, 8, 32, 126, [](char c, QRect& r) { if(c=='1'){r.setX(-2); r.setWidth(5);} if(c=='-'){r.setX(-1); r.setWidth(5);} }); + //FontBuilder fb(9); fb.addChars(fontPath+"/Nineteen Ninety Six.otf", 9, 7, 32, 126); + //FontBuilder fb(15); fb.addChars(fontPath+"/Mario64.ttf", 12, 12, 32, 126); + //FontBuilder fb(7); fb.addChars(fontPath+"/RNTG Larger.ttf", 7, 7, 32, 126, [](char c, QRect& r) {if(c=='1'){r.setX(0); r.setWidth(5);}}); + //FontBuilder fb(8); fb.addChars(fontPath+"/Bonni-Africa.ttf", 8, 7, 32, 126); + + //FontBuilder fb(8); fb.addCharsMonoFromImage("/apps/esp/PixelFont/res/fnt1.png", 3, 32, 126); + + // test for icons + FontBuilder fb(9); +// for (int i = 0; i < 10; ++i) { + fb.addDummy(); + //fb.addIcon("/apps/esp/PixelFont/res/icon/wifi.svg", 12, 0); + fb.addIcon("/apps/esp32/BoatRemote/icon/remote.svg", 11, 9, 0); + fb.addIcon("/apps/esp32/BoatRemote/icon/boat.svg", 12, 9, 0); + fb.addDummy(); +// } + + const FontBuilder::Result& res = fb.get(); + //res.dump("f1"); + res.dump("fIcon"); + + + + + struct F { + QPainter&p; + F(QPainter& p ) : p(p) {;} + void setPixel(int x, int y) { + p.drawPoint(QPointF(x,y)); + } + void fillRect(int x, int y, int w, int h) { + p.fillRect(x,y,w,h, Qt::blue); + } + }; + + + QPainter p(this); + p.setPen(Qt::black); + p.translate(10,10); + + F dst(p); + +// uint8_t data[] = {171,40,153,86,0,208,190,163,183,55,131,200,57,59,223,239,121,206,196,180,179,243,103,198,204,31,22,4,1,4,66,52,2,0,0,128,0,0,0,124,138,0,251,29,133,41,1,40,69,180,8,204,92,23,198,204,100,18,41,172,236,205,204,12,101,214,76,38,44,232,103,55,249,33,191,179,243,250,51,107,243,85,69,1,161,134,88,217,115,36,53,171,59,50,39,160,245,188,228,223,47,156,212,206,204,52,101,85,115,69,4,144,153,236,103,182,214,204,204,141,50,171,146,146,64,1,240,89,36,9,1,34,13,124,76,73,92,23,212,207,100,146,169,172,196,204,203,67,101,213,196,132,4,144,153,28,101,246,214,204,204,176,178,148,82,84,32,2,161,78,90,6,136,193,252,163,51,49,147,136,184,60,223,227,121,203,199,180,176,60,153,168,180,15,199,227,103,55,121,54,215,180,243,28,93,84,253,125,224,3,}; +// uint16_t offsets[] = {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,0,0,0,0,0,1,4,9,13,18,23,24,26,28,31,34,36,39,40,45,49,51,55,59,63,67,71,75,79,83,84,85,88,91,94,98,103,107,111,114,118,121,124,128,132,135,139,143,146,151,155,159,163,167,171,175,178,182,186,191,195,199,202,204,209,211,214,218,220,224,228,231,235,239,242,246,250,251,253,257,258,263,267,271,275,279,282,286,289,293,297,302,305,309,313,316,317,320,324,330,}; + + + FontWrap fnt(res.w, res.h, res.data.data(), res.offsets.data()); + + Draw d(dst); + + const char* txt = "!! ## AABBCCDD aabbccdd"; + + p.save(); + p.scale(6,6); + p.drawImage(0, 0, res.img); + p.restore(); + + + for (int i = 1; i <= 2; ++i) { + p.save(); + p.scale(i,i); + fnt.draw("--!\"#$%&'()*+,-./--", 20, 100, dst); + fnt.draw("--0123456789--", 20, 110, dst); + fnt.draw("--abcdefghijklmnopqrstuvwxyz--", 20, 120, dst); + fnt.draw("--ABCDEFGHIJKLMNOPQRSTUVWXYZ--", 20, 130, dst); + p.restore(); + } + +// d.drawRect(10,10, 30, 20); + +// uint8_t data = {255,255,255,255}; +// uint16_t offsets = {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,0,0,0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + + p.end(); + +} + diff --git a/tools/PixelFontGen/MainWindow.h b/tools/PixelFontGen/MainWindow.h new file mode 100644 index 0000000..a9919dd --- /dev/null +++ b/tools/PixelFontGen/MainWindow.h @@ -0,0 +1,25 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +namespace Ui { +class MainWindow; +} + +class MainWindow : public QMainWindow { + + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = nullptr); + ~MainWindow(); + +private: + //Ui::MainWindow *ui; + + void paintEvent(QPaintEvent* e) override; + +}; + +#endif // MAINWINDOW_H diff --git a/tools/PixelFontGen/MainWindow.ui b/tools/PixelFontGen/MainWindow.ui new file mode 100644 index 0000000..6050363 --- /dev/null +++ b/tools/PixelFontGen/MainWindow.ui @@ -0,0 +1,24 @@ + + MainWindow + + + + 0 + 0 + 400 + 300 + + + + MainWindow + + + + + + + + + + + diff --git a/tools/PixelFontGen/PixelFontGen.pro b/tools/PixelFontGen/PixelFontGen.pro new file mode 100644 index 0000000..10a4219 --- /dev/null +++ b/tools/PixelFontGen/PixelFontGen.pro @@ -0,0 +1,43 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2018-09-24T20:35:06 +# +#------------------------------------------------- + +QT += core gui widgets svg + +TARGET = test +TEMPLATE = app + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has been marked as deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +CONFIG += c++11 + +SOURCES += \ + main.cpp \ + MainWindow.cpp + +HEADERS += \ + MainWindow.h \ + FontBuilder.h \ + ../../ext/lcd/Draw.h \ + +FORMS += \ + MainWindow.ui + +INCLUDEPATH += \ + /apps + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target diff --git a/tools/PixelFontGen/PixelFontGen.pro.user b/tools/PixelFontGen/PixelFontGen.pro.user new file mode 100644 index 0000000..60754c4 --- /dev/null +++ b/tools/PixelFontGen/PixelFontGen.pro.user @@ -0,0 +1,335 @@ + + + + + + EnvironmentId + {662356ad-536e-4e17-8869-ff649e71cb1a} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + true + Builtin.DefaultTidyAndClazy + 4 + + + + true + + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop + {fe56f1ef-f99a-4240-b10b-b3bde6dd50d2} + 0 + 0 + 0 + + true + 0 + /apps/ESP8266lib/tools/build-PixelFontGen-Desktop-Debug + /apps/ESP8266lib/tools/build-PixelFontGen-Desktop-Debug + + + true + QtProjectManager.QMakeBuildStep + + false + + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + 2 + 2 + + + true + 2 + /apps/ESP8266lib/tools/build-PixelFontGen-Desktop-Release + /apps/ESP8266lib/tools/build-PixelFontGen-Desktop-Release + + + true + QtProjectManager.QMakeBuildStep + + false + + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + 2 + + + true + 0 + /apps/ESP8266lib/tools/build-PixelFontGen-Desktop-Profile + /apps/ESP8266lib/tools/build-PixelFontGen-Desktop-Profile + + + true + QtProjectManager.QMakeBuildStep + + false + + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + Qt4ProjectManager.Qt4RunConfiguration:/apps/ESP8266lib/tools/PixelFontGen/PixelFontGen.pro + /apps/ESP8266lib/tools/PixelFontGen/PixelFontGen.pro + + false + + false + true + true + false + false + true + + /apps/ESP8266lib/tools/build-PixelFontGen-Desktop-Debug + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/tools/PixelFontGen/main.cpp b/tools/PixelFontGen/main.cpp new file mode 100644 index 0000000..8d41aaa --- /dev/null +++ b/tools/PixelFontGen/main.cpp @@ -0,0 +1,14 @@ +#include "MainWindow.h" +#include + +#include + +int main(int argc, char *argv[]) { + + QApplication a(argc, argv); + MainWindow w; + w.show(); + + return a.exec(); + +}