Modify this code to allow STA WIFI

Hello to all, it`s my first post on arduino forum and i HOPE to be in the right place.
Recently i ordered a esp32 based 4 relay board that can be controlled by WIFI and BT.
Now i wanted to control it remote from other location and i realized that i cant because the board is only accepting AP and bluetooth (that not connecting anyway).
I contacted the seller and he said that i must modify the firmware and gived me this link: http://www.diymalls.com/files/FZ2707-esp32-bluetooth-relay-module.zip User: diymall Pass: diymall

He said to modify the 113-114 lines to make it work as STA to connect it to my AP. Can anyone help me ?
I`m a totally noob. Please excuse my poor english.

Looks like that 506 MB download only has a pointer to the actual source:

If you wants client mode, change these lines:

main.c line 315 where you change WIFI_MODE_AP (Access Point) to WIFI_MODE_STA (Station?):

	wifi_mode = WIFI_MODE_AP;

and
main.c lines 113 and 114 where you put your network's SSID and PASSWORD

	if (wifi_mode == WIFI_MODE_STA) {
	wifi_config_t conf = {
			.sta = {
				.ssid = "Nat",
				.password = "123456789",
				.bssid_set = false
			}
		};

		ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_AP, &conf) );
		ESP_ERROR_CHECK( esp_wifi_start() );
	}

WARNING: library ESP32WebServer-master claims to run on (ESP32) architecture(s) and may be incompatible with your current board which runs on (esp32) architecture(s).
C:\Users\Pip\AppData\Local\Temp\arduino_modified_sketch_270455\sketch_aug12a.ino: In function ‘void initialize_wifi()’:

sketch_aug12a:114: error: C99 designator ‘ssid’ outside aggregate initializer

};

^

sketch_aug12a:114: error: C99 designator ‘password’ outside aggregate initializer

C:\Users\Pip\AppData\Local\Temp\arduino_modified_sketch_270455\sketch_aug12a.ino:114:5: sorry, unimplemented: non-trivial designated initializers not supported

sketch_aug12a:128: error: C99 designator ‘ssid’ outside aggregate initializer

};

^

sketch_aug12a:128: error: C99 designator ‘password’ outside aggregate initializer

C:\Users\Pip\AppData\Local\Temp\arduino_modified_sketch_270455\sketch_aug12a.ino:128:5: sorry, unimplemented: non-trivial designated initializers not supported

C:\Users\Pip\AppData\Local\Temp\arduino_modified_sketch_270455\sketch_aug12a.ino:128:5: sorry, unimplemented: non-trivial designated initializers not supported

C:\Users\Pip\AppData\Local\Temp\arduino_modified_sketch_270455\sketch_aug12a.ino:128:5: sorry, unimplemented: non-trivial designated initializers not supported

C:\Users\Pip\AppData\Local\Temp\arduino_modified_sketch_270455\sketch_aug12a.ino:128:5: sorry, unimplemented: non-trivial designated initializers not supported

C:\Users\Pip\AppData\Local\Temp\arduino_modified_sketch_270455\sketch_aug12a.ino:128:5: sorry, unimplemented: non-trivial designated initializers not supported

C:\Users\Pip\AppData\Local\Temp\arduino_modified_sketch_270455\sketch_aug12a.ino: In function ‘int set_relay_state(int, uint32_t)’:

sketch_aug12a:137: error: invalid conversion from ‘int’ to ‘gpio_num_t’ [-fpermissive]

gpio_set_level(cntrl_pins[relay], level);

^

In file included from C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0/tools/sdk/include/esp32/esp_sleep.h:19:0,

from C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0/tools/sdk/include/esp32/esp_system.h:21,

from C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0/tools/sdk/include/freertos/freertos/portable.h:126,

from C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0/tools/sdk/include/freertos/freertos/FreeRTOS.h:105,

from C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\cores\esp32/Arduino.h:32,

from sketch\sketch_aug12a.ino.cpp:1:

C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0/tools/sdk/include/driver/driver/gpio.h:315:11: note: initializing argument 1 of ‘esp_err_t gpio_set_level(gpio_num_t, uint32_t)’

esp_err_t gpio_set_level(gpio_num_t gpio_num, uint32_t level);

^

C:\Users\Pip\AppData\Local\Temp\arduino_modified_sketch_270455\sketch_aug12a.ino: In function ‘int app_main()’:

sketch_aug12a:303: error: invalid conversion from ‘int’ to ‘gpio_num_t’ [-fpermissive]

gpio_set_direction(cntrl_pins*, GPIO_MODE_OUTPUT);*

  • ^*
    In file included from C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0/tools/sdk/include/esp32/esp_sleep.h:19:0,
  • from C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0/tools/sdk/include/esp32/esp_system.h:21,*
  • from C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0/tools/sdk/include/freertos/freertos/portable.h:126,*
  • from C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0/tools/sdk/include/freertos/freertos/FreeRTOS.h:105,*
  • from C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\cores\esp32/Arduino.h:32,*
  • from sketch\sketch_aug12a.ino.cpp:1:*
    C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0/tools/sdk/include/driver/driver/gpio.h:344:11: note: initializing argument 1 of ‘esp_err_t gpio_set_direction(gpio_num_t, gpio_mode_t)’
    esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_mode_t mode);
  • ^*
    sketch_aug12a:304: error: invalid conversion from ‘int’ to ‘gpio_num_t’ [-fpermissive]
    gpio_set_level(cntrl_pins*, 0);
    _
    ^_
    Multiple libraries were found for “WiFiServer.h”
    Used: C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\WiFi
    In file included from C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0/tools/sdk/include/esp32/esp_sleep.h:19:0,
    Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
    Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
    Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
    from C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0/tools/sdk/include/esp32/esp_system.h:21,
    Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
    _
    from C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0/tools/sdk/include/freertos/freertos/portable.h:126,_
    _
    from C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0/tools/sdk/include/freertos/freertos/FreeRTOS.h:105,_
    _
    from C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\cores\esp32/Arduino.h:32,_
    from sketch\sketch_aug12a.ino.cpp:1:
    C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0/tools/sdk/include/driver/driver/gpio.h:315:11: note: initializing argument 1 of ‘esp_err_t gpio_set_level(gpio_num_t, uint32_t)’
    esp_err_t gpio_set_level(gpio_num_t gpio_num, uint32_t level);
    _
    ^_
    sketch_aug12a:308: error: invalid conversion from 'void ()()’ to ‘TaskFunction_t {aka void ()(void)}’ [-fpermissive]

    * xTaskCreate(&generate_json, “json”, 2048, NULL, 5, NULL);
    _
    ^_
    In file included from C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\cores\esp32/Arduino.h:33:0,
    from sketch\sketch_aug12a.ino.cpp:1:
    C:\Users\Pip\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0/tools/sdk/include/freertos/freertos/task.h:430:37: note: initializing argument 1 of 'BaseType_t xTaskCreate(TaskFunction_t, const char, uint32_t, void*, UBaseType_t, void**)’

    * static inline IRAM_ATTR BaseType_t xTaskCreate(
    _
    ^_
    exit status 1
    C99 designator ‘ssid’ outside aggregate initializer
    I tried to program the esp with your modified lines but this happens. I changed between 4 esp32 board but the same happens.
    Added a picture of the problem
    _
    *_

It looks like part of the problem might be that .ino files are compiled as C++ and the original "main.c" is written in "C". Try putting creating a new tab (use the little 'down arrow' menu at the right) and name it "main.c". Then move all the code to there. Try the compile again.