Skip to content

Commit d956e6b

Browse files
committed
fix issue so that a header line is only written once - after mime type line
1 parent 2125069 commit d956e6b

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/Flux/flxSerial.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,23 @@ class flxSerial_ : public flxWriter
5353
{
5454

5555
// If this is a header, we add a stream indicator to the output
56-
// tart the stream with a Mime Type marker, followed by CR
56+
// start the stream with a Mime Type marker, followed by CR
5757
if (type == flxLineTypeMime){
5858
Serial.println();
5959
Serial.println(value);
6060
Serial.println();
61+
62+
// next we'll want to do a header
63+
_headerWritten = false;
64+
}
65+
else if (type == flxLineTypeHeader)
66+
{
67+
// only want to write this out once
68+
if (_headerWritten == false)
69+
{
70+
Serial.println(value);
71+
_headerWritten = true;
72+
}
6173
}
6274
else
6375
{
@@ -93,7 +105,8 @@ class flxSerial_ : public flxWriter
93105
void operator=(flxSerial_ const &) = delete;
94106

95107
private:
96-
flxSerial_(){};
108+
flxSerial_() : _headerWritten{false}{};
109+
bool _headerWritten;
97110
};
98111

99112
typedef flxSerial_ *flxSerial;

0 commit comments

Comments
 (0)