@@ -39,8 +39,8 @@ extern "C" {
3939#define beget16 (addr ) (*addr * 256 + *(addr+1 ))
4040
4141ESP8266AVRISP::ESP8266AVRISP (uint16_t port, uint8_t reset_pin, uint32_t spi_freq, bool reset_state, bool reset_activehigh):
42- _reset_pin(reset_pin ), _reset_state(reset_state), _spi_freq(spi_freq), _reset_activehigh(reset_activehigh ),
43- _server(WiFiServer(port)), _state(AVRISP_STATE_IDLE )
42+ _spi_freq(spi_freq ), _server(WiFiServer(port)), _state(AVRISP_STATE_IDLE ),
43+ _reset_pin(reset_pin), _reset_state(reset_state), _reset_activehigh(reset_activehigh )
4444{
4545 pinMode (_reset_pin, OUTPUT);
4646 setReset (_reset_state);
@@ -71,6 +71,7 @@ AVRISPState_t ESP8266AVRISP::update() {
7171 ip_addr_t lip;
7272 lip.addr = _client.remoteIP ();
7373 AVRISP_DEBUG (" client connect %d.%d.%d.%d:%d" , IP2STR (&lip), _client.remotePort ());
74+ (void ) lip; // Avoid unused warning when not in debug mode
7475 _client.setTimeout (100 ); // for getch()
7576 _state = AVRISP_STATE_PENDING;
7677 _reject_incoming ();
@@ -136,10 +137,9 @@ void ESP8266AVRISP::fill(int n) {
136137}
137138
138139uint8_t ESP8266AVRISP::spi_transaction (uint8_t a, uint8_t b, uint8_t c, uint8_t d) {
139- uint8_t n;
140140 SPI.transfer (a);
141- n = SPI.transfer (b);
142- n = SPI.transfer (c);
141+ SPI.transfer (b);
142+ SPI.transfer (c);
143143 return SPI.transfer (d);
144144}
145145
@@ -233,7 +233,6 @@ void ESP8266AVRISP::end_pmode() {
233233}
234234
235235void ESP8266AVRISP::universal () {
236- int w;
237236 uint8_t ch;
238237
239238 fill (4 );
@@ -265,8 +264,6 @@ int ESP8266AVRISP::addr_page(int addr) {
265264
266265
267266void ESP8266AVRISP::write_flash (int length) {
268- uint32_t started = millis ();
269-
270267 fill (length);
271268
272269 if (Sync_CRC_EOP == getch ()) {
@@ -331,7 +328,6 @@ void ESP8266AVRISP::program_page() {
331328 int length = 256 * getch ();
332329 length += getch ();
333330 char memtype = getch ();
334- char buf[100 ];
335331 // flash memory @here, (length) bytes
336332 if (memtype == ' F' ) {
337333 write_flash (length);
@@ -390,7 +386,6 @@ void ESP8266AVRISP::eeprom_read_page(int length) {
390386}
391387
392388void ESP8266AVRISP::read_page () {
393- char result = (char )Resp_STK_FAILED;
394389 int length = 256 * getch ();
395390 length += getch ();
396391 char memtype = getch ();
@@ -424,9 +419,13 @@ void ESP8266AVRISP::read_signature() {
424419
425420// It seems ArduinoISP is based on the original STK500 (not v2)
426421// but implements only a subset of the commands.
427- int ESP8266AVRISP::avrisp () {
422+ void ESP8266AVRISP::avrisp () {
428423 uint8_t data, low, high;
429424 uint8_t ch = getch ();
425+ // Avoid set but not used warning. Leaving them in as it helps document the code
426+ (void ) data;
427+ (void ) low;
428+ (void ) high;
430429 // AVRISP_DEBUG("CMD 0x%02x", ch);
431430 switch (ch) {
432431 case Cmnd_STK_GET_SYNC:
@@ -517,7 +516,7 @@ int ESP8266AVRISP::avrisp() {
517516
518517 // anything else we will return STK_UNKNOWN
519518 default :
520- AVRISP_DEBUG (" ?? !?" );
519+ AVRISP_DEBUG (" ?!?" );
521520 error++;
522521 if (Sync_CRC_EOP == getch ()) {
523522 _client.print ((char )Resp_STK_UNKNOWN);
0 commit comments