Skip to content

Commit 859f7dd

Browse files
fix off-by-one bug in setFirmwareNameAndVersion. bump buxfix version. formata some files
1 parent f16480b commit 859f7dd

File tree

6 files changed

+292
-292
lines changed

6 files changed

+292
-292
lines changed

Firmata.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Firmata.cpp - Firmata library v2.6.1 - 2014-12-28
2+
Firmata.cpp - Firmata library v2.6.2 - 2015-2-7
33
Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved.
44
55
This library is free software; you can redistribute it and/or
@@ -146,7 +146,7 @@ void FirmataClass::setFirmwareNameAndVersion(const char *name, byte major, byte
146146
// in case anyone calls setFirmwareNameAndVersion more than once
147147
free(firmwareVersionVector);
148148

149-
firmwareVersionVector = (byte *) malloc(firmwareVersionCount);
149+
firmwareVersionVector = (byte *) malloc(firmwareVersionCount + 1);
150150
firmwareVersionVector[firmwareVersionCount] = 0;
151151
firmwareVersionVector[0] = major;
152152
firmwareVersionVector[1] = minor;

Firmata.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Firmata.h - Firmata library v2.6.1 - 2014-12-28
2+
Firmata.h - Firmata library v2.6.2 - 2015-2-7
33
Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved.
44
55
This library is free software; you can redistribute it and/or
@@ -21,7 +21,7 @@
2121
* installed firmware. */
2222
#define FIRMATA_MAJOR_VERSION 2 // for non-compatible changes
2323
#define FIRMATA_MINOR_VERSION 6 // for backwards compatible changes
24-
#define FIRMATA_BUGFIX_VERSION 1 // for bugfix releases
24+
#define FIRMATA_BUGFIX_VERSION 2 // for bugfix releases
2525

2626
#define MAX_DATA_BYTES 64 // max number of data bytes in incoming messages
2727

examples/ConfigurableFirmata/ConfigurableFirmata.ino

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
Copyright (C) 2009-2013 Jeff Hoefs. All rights reserved.
1717
Copyright (C) 2013 Norbert Truchsess. All rights reserved.
1818
Copyright (C) 2014 Nicolas Panel. All rights reserved.
19-
19+
2020
This library is free software; you can redistribute it and/or
2121
modify it under the terms of the GNU Lesser General Public
2222
License as published by the Free Software Foundation; either
2323
version 2.1 of the License, or (at your option) any later version.
24-
24+
2525
See file LICENSE.txt for further informations on licensing terms.
2626
2727
formatted using the GNU C formatting and indenting
@@ -30,9 +30,9 @@
3030

3131
#include <Firmata.h>
3232

33-
/*
34-
* by default Firmata uses the Serial-port (over USB) of Arduino.
35-
* ConfigurableFirmata may also comunicate over ethernet using tcp/ip.
33+
/*
34+
* by default Firmata uses the Serial-port (over USB) of Arduino.
35+
* ConfigurableFirmata may also comunicate over ethernet using tcp/ip.
3636
* To configure this 'Network Firmata' to use the original WIZ5100-based
3737
* ethernet-shield or Arduino Ethernet uncomment the includes of 'SPI.h' and 'Ethernet.h':
3838
*/
@@ -72,11 +72,11 @@
7272
//replace with arduinos ip-address. Comment out if Ethernet-startup should use dhcp. Is ignored on Yun
7373
#define local_ip IPAddress(192,168,0,6)
7474
//replace with ethernet shield mac. It's mandatory every device is assigned a unique mac. Is ignored on Yun
75-
const byte mac[] = {0x90,0xA2,0xDA,0x0D,0x07,0x02};
75+
const byte mac[] = {0x90, 0xA2, 0xDA, 0x0D, 0x07, 0x02};
7676
#endif
7777

7878
// To configure, save this file to your working directory so you can edit it
79-
// then comment out the include and declaration for any features that you do
79+
// then comment out the include and declaration for any features that you do
8080
// not need below.
8181

8282
// Also note that the current compile size for an Arduino Uno with all of the
@@ -143,16 +143,16 @@ EthernetClient client;
143143
#endif
144144
#if defined remote_ip && !defined remote_host
145145
#ifdef local_ip
146-
EthernetClientStream stream(client,local_ip,remote_ip,NULL,remote_port);
146+
EthernetClientStream stream(client, local_ip, remote_ip, NULL, remote_port);
147147
#else
148-
EthernetClientStream stream(client,IPAddress(0,0,0,0),remote_ip,NULL,remote_port);
148+
EthernetClientStream stream(client, IPAddress(0, 0, 0, 0), remote_ip, NULL, remote_port);
149149
#endif
150150
#endif
151151
#if !defined remote_ip && defined remote_host
152152
#ifdef local_ip
153-
EthernetClientStream stream(client,local_ip,IPAddress(0,0,0,0),remote_host,remote_port);
153+
EthernetClientStream stream(client, local_ip, IPAddress(0, 0, 0, 0), remote_host, remote_port);
154154
#else
155-
EthernetClientStream stream(client,IPAddress(0,0,0,0),IPAddress(0,0,0,0),remote_host,remote_port);
155+
EthernetClientStream stream(client, IPAddress(0, 0, 0, 0), IPAddress(0, 0, 0, 0), remote_host, remote_port);
156156
#endif
157157
#endif
158158
#endif
@@ -167,7 +167,7 @@ void systemResetCallback()
167167

168168
// pins with analog capability default to analog input
169169
// otherwise, pins default to digital output
170-
for (byte i=0; i < TOTAL_PINS; i++) {
170+
for (byte i = 0; i < TOTAL_PINS; i++) {
171171
if (IS_PIN_ANALOG(i)) {
172172
#ifdef AnalogInputFirmata_h
173173
// turns off pullup, configures everything
@@ -190,16 +190,16 @@ void systemResetCallback()
190190
* SETUP()
191191
*============================================================================*/
192192

193-
void setup()
193+
void setup()
194194
{
195195
#ifdef NETWORK_FIRMATA
196196
#ifdef _YUN_CLIENT_H_
197197
Bridge.begin();
198198
#else
199199
#ifdef local_ip
200-
Ethernet.begin((uint8_t*)mac,local_ip); //start ethernet
200+
Ethernet.begin((uint8_t *)mac, local_ip); //start ethernet
201201
#else
202-
Ethernet.begin((uint8_t*)mac); //start ethernet using dhcp
202+
Ethernet.begin((uint8_t *)mac); //start ethernet using dhcp
203203
#endif
204204
#endif
205205
delay(1000);
@@ -211,7 +211,7 @@ void setup()
211211
Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
212212
#endif
213213

214-
#ifdef FirmataExt_h
214+
#ifdef FirmataExt_h
215215
#ifdef DigitalInputFirmata_h
216216
firmataExt.addFeature(digitalInput);
217217
#endif
@@ -255,15 +255,15 @@ void setup()
255255
// No need to ignore pin 10 on MEGA with ENC28J60, as here pin 53 should be connected to SS:
256256
#ifdef NETWORK_FIRMATA
257257
// ignore SPI and pin 4 that is SS for SD-Card on Ethernet-shield
258-
for (byte i=0; i < TOTAL_PINS; i++) {
258+
for (byte i = 0; i < TOTAL_PINS; i++) {
259259
if (IS_PIN_SPI(i)
260-
|| 4==i
260+
|| 4 == i
261261
// || 10==i //explicitly ignore pin 10 on MEGA as 53 is hardware-SS but Ethernet-shield uses pin 10 for SS
262-
) {
262+
) {
263263
Firmata.setPinMode(i, IGNORE);
264264
}
265265
}
266-
// pinMode(PIN_TO_DIGITAL(53), OUTPUT); configure hardware-SS as output on MEGA
266+
// pinMode(PIN_TO_DIGITAL(53), OUTPUT); configure hardware-SS as output on MEGA
267267
pinMode(PIN_TO_DIGITAL(4), OUTPUT); // switch off SD-card bypassing Firmata
268268
digitalWrite(PIN_TO_DIGITAL(4), HIGH); // SS is active low;
269269

@@ -279,7 +279,7 @@ void setup()
279279
/*==============================================================================
280280
* LOOP()
281281
*============================================================================*/
282-
void loop()
282+
void loop()
283283
{
284284
#ifdef DigitalInputFirmata_h
285285
/* DIGITALREAD - as fast as possible, check for changes and output them to the
@@ -289,7 +289,7 @@ void loop()
289289

290290
/* STREAMREAD - processing incoming messagse as soon as possible, while still
291291
* checking digital inputs. */
292-
while(Firmata.available()) {
292+
while (Firmata.available()) {
293293
Firmata.processInput();
294294
#ifdef FirmataScheduler_h
295295
if (!Firmata.isParsingMessage()) {
@@ -326,8 +326,8 @@ runtasks: scheduler.runTasks();
326326
#endif
327327
#if defined NETWORK_FIRMATA && !defined local_ip &&!defined _YUN_CLIENT_H_
328328
if (Ethernet.maintain())
329-
{
330-
stream.maintain(Ethernet.localIP());
331-
}
329+
{
330+
stream.maintain(Ethernet.localIP());
331+
}
332332
#endif
333333
}

0 commit comments

Comments
 (0)