TTGOv1 support added (experimental)

This commit is contained in:
Klaus K Wilting 2018-03-21 14:33:55 +01:00
parent 825943c2e5
commit cf7c908883
6 changed files with 24 additions and 7 deletions

View File

@ -153,6 +153,10 @@ Note: all settings are stored in NVRAM and will be reloaded when device starts.
0x81 get device uptime
bytes 1-7: Uptime in seconds (little endian format)
0x82 get device cpu temperature
bytes 1-3: chip temperature in celsius (little endian format)
# License

View File

@ -10,8 +10,8 @@
[platformio]
;env_default = heltec_wifi_lora_32
;env_default = ttgov2
env_default = ttgov1
env_default = ttgov2
;env_default = ttgov1
;env_default = lopy
;env_default = lopy4

View File

@ -342,6 +342,7 @@ void setup() {
(chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "",
chip_info.revision, spi_flash_get_chip_size() / (1024 * 1024),
(chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
ESP_LOGI(TAG, "ESP32 SDK: %s", ESP.getSdkVersion());
#endif // VERBOSE
// Read settings from NVRAM

View File

@ -1,5 +1,5 @@
// program version
#define PROGVERSION "1.2.21" // use max 10 chars here!
#define PROGVERSION "1.2.22" // use max 10 chars here!
#define PROGNAME "PAXCNT"
// Verbose enables serial output

View File

@ -165,7 +165,7 @@ void get_config (int val) {
memcpy(sendData, &cfg, size);
LMIC_setTxData2(RCMDPORT, sendData, size-1, 0); // send data unconfirmed on RCMD Port
delete sendData; // free memory
ESP_LOGI(TAG, "Configuration data queued in send queue");
ESP_LOGI(TAG, "%i bytes queued in send queue", size-1);
};
void get_uptime (int val) {
@ -175,7 +175,18 @@ void get_uptime (int val) {
memcpy(sendData, (unsigned char*)&uptimecounter, size);
LMIC_setTxData2(RCMDPORT, sendData, size-1, 0); // send data unconfirmed on RCMD Port
delete sendData; // free memory
ESP_LOGI(TAG, "Uptime queued in send queue");
ESP_LOGI(TAG, "%i bytes queued in send queue", size-1);
};
void get_cputemp (int val) {
ESP_LOGI(TAG, "Remote command: get cpu temperature");
float temp = temperatureRead();
int size = sizeof(temp);
unsigned char *sendData = new unsigned char[size];
memcpy(sendData, (unsigned char*)&temp, size);
LMIC_setTxData2(RCMDPORT, sendData, size-1, 0); // send data unconfirmed on RCMD Port
delete sendData; // free memory
ESP_LOGI(TAG, "%i bytes queued in send queue", size-1);
};
// assign previously defined functions to set of numeric remote commands
@ -197,6 +208,7 @@ cmd_t table[] = {
{0x0d, set_blescan, true},
{0x80, get_config, false},
{0x81, get_uptime, false},
{0x82, get_cputemp, false}
};
// check and execute remote command

View File

@ -48,8 +48,8 @@ void wifi_sniffer_init(void) {
cfg.nvs_enable = 0; // we don't want wifi settings from NVRAM
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
ESP_ERROR_CHECK(esp_wifi_set_country(&wifi_country));
//ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
//ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_NULL) );
ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_RAM) );
//ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_NULL) );
//ESP_ERROR_CHECK( esp_wifi_start() );
//ESP_ERROR_CHECK( esp_wifi_set_max_tx_power(-128) ); // we don't need to TX, so we use lowest power level to save energy
wifi_promiscuous_filter_t filter = {.filter_mask = WIFI_PROMIS_FILTER_MASK_MGMT}; // we need only MGMT frames