@@ -39,8 +39,8 @@ extern "C" {
39
39
#define beget16 (addr ) (*addr * 256 + *(addr+1 ))
40
40
41
41
ESP8266AVRISP::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 )
44
44
{
45
45
pinMode (_reset_pin, OUTPUT);
46
46
setReset (_reset_state);
@@ -71,6 +71,7 @@ AVRISPState_t ESP8266AVRISP::update() {
71
71
ip_addr_t lip;
72
72
lip.addr = _client.remoteIP ();
73
73
AVRISP_DEBUG (" client connect %d.%d.%d.%d:%d" , IP2STR (&lip), _client.remotePort ());
74
+ (void ) lip; // Avoid unused warning when not in debug mode
74
75
_client.setTimeout (100 ); // for getch()
75
76
_state = AVRISP_STATE_PENDING;
76
77
_reject_incoming ();
@@ -136,10 +137,9 @@ void ESP8266AVRISP::fill(int n) {
136
137
}
137
138
138
139
uint8_t ESP8266AVRISP::spi_transaction (uint8_t a, uint8_t b, uint8_t c, uint8_t d) {
139
- uint8_t n;
140
140
SPI.transfer (a);
141
- n = SPI.transfer (b);
142
- n = SPI.transfer (c);
141
+ SPI.transfer (b);
142
+ SPI.transfer (c);
143
143
return SPI.transfer (d);
144
144
}
145
145
@@ -233,7 +233,6 @@ void ESP8266AVRISP::end_pmode() {
233
233
}
234
234
235
235
void ESP8266AVRISP::universal () {
236
- int w;
237
236
uint8_t ch;
238
237
239
238
fill (4 );
@@ -265,8 +264,6 @@ int ESP8266AVRISP::addr_page(int addr) {
265
264
266
265
267
266
void ESP8266AVRISP::write_flash (int length) {
268
- uint32_t started = millis ();
269
-
270
267
fill (length);
271
268
272
269
if (Sync_CRC_EOP == getch ()) {
@@ -331,7 +328,6 @@ void ESP8266AVRISP::program_page() {
331
328
int length = 256 * getch ();
332
329
length += getch ();
333
330
char memtype = getch ();
334
- char buf[100 ];
335
331
// flash memory @here, (length) bytes
336
332
if (memtype == ' F' ) {
337
333
write_flash (length);
@@ -390,7 +386,6 @@ void ESP8266AVRISP::eeprom_read_page(int length) {
390
386
}
391
387
392
388
void ESP8266AVRISP::read_page () {
393
- char result = (char )Resp_STK_FAILED;
394
389
int length = 256 * getch ();
395
390
length += getch ();
396
391
char memtype = getch ();
@@ -424,9 +419,13 @@ void ESP8266AVRISP::read_signature() {
424
419
425
420
// It seems ArduinoISP is based on the original STK500 (not v2)
426
421
// but implements only a subset of the commands.
427
- int ESP8266AVRISP::avrisp () {
422
+ void ESP8266AVRISP::avrisp () {
428
423
uint8_t data, low, high;
429
424
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;
430
429
// AVRISP_DEBUG("CMD 0x%02x", ch);
431
430
switch (ch) {
432
431
case Cmnd_STK_GET_SYNC:
@@ -517,7 +516,7 @@ int ESP8266AVRISP::avrisp() {
517
516
518
517
// anything else we will return STK_UNKNOWN
519
518
default :
520
- AVRISP_DEBUG (" ?? !?" );
519
+ AVRISP_DEBUG (" ?!?" );
521
520
error++;
522
521
if (Sync_CRC_EOP == getch ()) {
523
522
_client.print ((char )Resp_STK_UNKNOWN);
0 commit comments