Browse Source

WIFI credentials from secret variables

main
Hendrik Langer 8 years ago
parent
commit
6b564805c4
  1. 12
      .gitlab-ci.yml
  2. 7
      src/main.cpp

12
.gitlab-ci.yml

@ -1,10 +1,16 @@
image: eclipse/platformio
before_script:
- sudo pip install -U PlatformIO
- platformio platform install https://github.com/platformio/platform-espressif32.git#feature/stage
build:
image: eclipse/platformio
stage: build
script:
- sudo pip install -U PlatformIO
# - platformio lib -g install 1
# - platformio ci --board=esp32thing
- platformio platform install https://github.com/platformio/platform-espressif32.git#feature/stage
- sed -i "s/^\(#define WIFI_SSID \).*/\1\"$WIFI_SSID\"/" src/main.cpp
- sed -i "s/^\(#define WIFI_PASSWORD \).*/\1\"$WIFI_PASSWORD\"/" src/main.cpp
- platformio run
- ln -s .pioenvs/esp32thing build
- cp /home/user/.platformio/packages/framework-arduinoespressif32/tools/sdk/bin/bootloader.bin build/

7
src/main.cpp

@ -16,6 +16,9 @@
#define LED_PIN 21
#define BUF_LENGTH 1024
#define WIFI_SSID "ssid"
#define WIFI_PASSWORD "password"
Keyboard keyboard;
SDCard sdcard;
Sound sound;
@ -44,13 +47,13 @@ void sd_read_task(void *pvParameter) {
void i2s_write_task(void *pvParameter) {
for ( ;; ) {
TickType_t delay = 10 / portTICK_PERIOD_MS; // max delay: 10ms instead of portMAX_DELAY
//TickType_t delay = 10 / portTICK_PERIOD_MS; // max delay: 10ms instead of portMAX_DELAY
uint16_t *start_ptr = ringbuf.getRead();
size_t size_avail = ringbuf.getReadAvail();
int num_samples = 0;
for (int i=0; i<size_avail; i++) {
unsigned int sample = ((unsigned short) start_ptr[i] << 16 & 0xffff0000) | ((unsigned short) start_ptr[i]);
int num_pushed_bytes = i2s_push_sample(sound.i2s_num, (char *)&sample, delay);
int num_pushed_bytes = i2s_push_sample(sound.i2s_num, (char *)&sample, 0);
num_samples += num_pushed_bytes/4;
}
ringbuf.setRead(num_samples);

Loading…
Cancel
Save