ESPixelStick Firmware
Firmware for the ESPixelStick
Loading...
Searching...
No Matches
EFUpdate.h
Go to the documentation of this file.
1/*
2* EFUpdate.h
3*
4* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver
5* Copyright (c) 2016, 2025 Shelby Merrick
6* http://www.forkineye.com
7*
8* This program is provided free for you to use in any way that you wish,
9* subject to the laws and regulations where you are using it. Due diligence
10* is strongly suggested before using this code. Please give credit where due.
11*
12* The Author makes no warranty of any kind, express or implied, with regard
13* to this program or the documentation contained in this document. The
14* Author shall not be liable in any event for incidental or consequential
15* damages in connection with, or arising out of, the furnishing, performance
16* or use of these programs.
17*
18*/
19
20#ifndef EFUPDATE_H_
21#define EFUPDATE_H_
22
23#define EFUPDATE_ERROR_OK (0)
24#define EFUPDATE_ERROR_SIG (100)
25#define EFUPDATE_ERROR_REC (101)
26
27class EFUpdate {
28 public:
30 virtual ~EFUpdate() {}
31
32 const uint32_t EFU_ID = 0x00554645; // 'E', 'F', 'U', 0x00
33
34 void begin();
35 bool process(uint8_t *data, uint32_t len);
36 bool hasError();
37 uint8_t getError(String & msg);
38 bool end();
39 void GetDriverName(String & name) {name = String(F("EFUPD"));}
41
42 private:
43 /* Record types */
44 enum class RecordType : uint16_t {
49 };
50
51 /* Update State */
52 enum class State : uint8_t {
53 HEADER,
54 RECORD,
55 DATA,
56 FAIL,
57 IDLE
58 };
59
60 /* EFU Header */
61 typedef union {
62 struct {
63 uint32_t signature;
64 uint16_t version;
65 } __attribute__((packed));
66
67 uint8_t raw[6];
69
70 /* EFU Record */
71 typedef union {
72 struct {
74 uint32_t size;
75 } __attribute__((packed));
76
77 uint8_t raw[6];
79
81 uint32_t _loc = 0;
84 uint32_t _maxSketchSpace = 0;
86 String _errorMsg;
87
89
90};
91
92#endif /* EFUPDATE_H_ */
#define EFUPDATE_ERROR_OK
Definition EFUpdate.h:23
Definition EFUpdate.h:27
bool process(uint8_t *data, uint32_t len)
Definition EFUpdate.cpp:60
efuheader_t _header
Definition EFUpdate.h:82
State _state
Definition EFUpdate.h:80
efurecord_t _record
Definition EFUpdate.h:83
void ConvertErrorToString()
Definition EFUpdate.cpp:234
RecordType
Definition EFUpdate.h:44
uint8_t _error
Definition EFUpdate.h:85
bool hasError()
Definition EFUpdate.cpp:222
bool UpdateIsInProgress()
Definition EFUpdate.h:40
State
Definition EFUpdate.h:52
EFUpdate()
Definition EFUpdate.h:29
virtual ~EFUpdate()
Definition EFUpdate.h:30
uint32_t _loc
Definition EFUpdate.h:81
uint32_t _maxSketchSpace
Definition EFUpdate.h:84
uint8_t getError(String &msg)
Definition EFUpdate.cpp:227
String _errorMsg
Definition EFUpdate.h:86
void GetDriverName(String &name)
Definition EFUpdate.h:39
const uint32_t EFU_ID
Definition EFUpdate.h:32
bool end()
Definition EFUpdate.cpp:313
void begin()
Definition EFUpdate.cpp:44
struct FSEQParsedRangeEntry __attribute__
Definition EFUpdate.h:61
uint32_t signature
Definition EFUpdate.h:63
uint16_t version
Definition EFUpdate.h:64
Definition EFUpdate.h:71
uint32_t size
Definition EFUpdate.h:74
RecordType type
Definition EFUpdate.h:73