Skip to content

Commit f51ed40

Browse files
committed
Rename to OpenShock
1 parent b1ed6c8 commit f51ed40

39 files changed

+164
-150
lines changed

.github/workflows/ci-build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ name: ci-build
2020
env:
2121
NODE_VERSION: 16
2222
PYTHON_VERSION: 3.11
23-
SHOCKLINK_API_DOMAIN: api.shocklink.net
24-
SHOCKLINK_FW_VERSION: master-${{ github.sha }}
23+
OPENSHOCK_API_DOMAIN: api.shocklink.net
24+
OPENSHOCK_FW_VERSION: master-${{ github.sha }}
2525

2626
jobs:
2727

.github/workflows/ci-tag.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ on:
66
name: ci-tag
77

88
env:
9-
SHOCKLINK_API_DOMAIN: api.shocklink.net
10-
SHOCKLINK_FW_VERSION: ${{ github.ref_name }}
9+
OPENSHOCK_API_DOMAIN: api.shocklink.net
10+
OPENSHOCK_FW_VERSION: ${{ github.ref_name }}
1111

1212
jobs:
1313

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
# ShockLink (ESP-32) Firmware
2-
ESP-32 Firmware for ShockLink. Controlling shockers via 433 MHz RF.
1+
# OpenShock (ESP-32) Firmware
2+
ESP-32 Firmware for OpenShock. Controlling shockers via 433 MHz RF.
33

44
## Compatible Hardware
5-
You will need a ESP-32 and a 433 MHz antenna attached to it. For more info about buying such hardware see here [ShockLink Wiki - Hardware: Buy](https://docs.shocklink.net/en/Hardware/Buy).
6-
Guide for assembly can be found here [ShockLink Wiki - Hardware: Assembly](https://docs.shocklink.net/en/Hardware/Assembly)
5+
You will need a ESP-32 and a 433 MHz antenna attached to it. For more info about buying such hardware see here [OpenShock Wiki - Hardware: Buy](https://docs.shocklink.net/en/Hardware/Buy).
6+
Guide for assembly can be found here [OpenShock Wiki - Hardware: Assembly](https://docs.shocklink.net/en/Hardware/Assembly)
77

88
Confirmed working ESP's:
99

1010
+ Wemos Mini D1 ESP32-WROOM-32
1111

1212
## Flashing
13-
Refer to [ShockLink Wiki - Device: Flashing](https://docs.shocklink.net/en/Device/Setup/Flashing) on how to flash your micro controller.
13+
Refer to [OpenShock Wiki - Device: Flashing](https://docs.shocklink.net/en/Device/Setup/Flashing) on how to flash your micro controller.
1414

1515
Other than that, you can just flash via platform io in vscode. More in the contribute section.
1616

1717
## Contribute
1818
You will need:
19-
+ VSCode
20-
+ Knowledge about Arduino library and C++
21-
+ Optimally compatible hardware to test your code
19+
- VSCode
20+
- Knowledge about Arduino library and C++
21+
- Optimally compatible hardware to test your code

WebUI/src/lib/components/Layout/Footer.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div>
77
Made with
88
<span style="color: #e25555;">&#9829;</span>
9-
by the ShockLink Team
9+
by the OpenShock Team
1010
</div>
1111
<div class="hidden sm:block">Copyright ©{year} | All Rights Reserved</div>
1212
</div>

WebUI/src/lib/components/Layout/Header.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div slot="lead" class="flex items-center space-x-4">
77
<!-- Logo -->
88
<a href="/" class="overflow-hidden lg:!ml-0 lg:w-auto select-none" data-sveltekit-preload-data="hover">
9-
<img class="inline-block h-12 pointer-events-none" src="/logo.svg" alt="ShockLink Logo" />
9+
<img class="inline-block h-12 pointer-events-none" src="/logo.svg" alt="OpenShock Logo" />
1010
</a>
1111
</div>
1212
<svelte:fragment slot="trail">

embed_version.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
# Fetch environment variables, with sane defaults if not found.
99
# These variables should be defined by the CI.
10-
shocklinkApiDomain = os.getenv('SHOCKLINK_API_DOMAIN') or "api.shocklink.net"
11-
shocklinkFwVersion = os.getenv('SHOCKLINK_FW_VERSION') or "0.8.1"
10+
openshockApiDomain = os.getenv('OPENSHOCK_API_DOMAIN') or "api.shocklink.net"
11+
openshockFwVersion = os.getenv('OPENSHOCK_FW_VERSION') or "0.8.1"
1212

1313
# Define these variables as macros for expansion during build time.
1414
env.Append(CPPDEFINES=[
15-
("SHOCKLINK_API_DOMAIN", env.StringifyMacro(shocklinkApiDomain)),
16-
("SHOCKLINK_FW_VERSION", env.StringifyMacro(shocklinkFwVersion))
15+
("OPENSHOCK_API_DOMAIN", env.StringifyMacro(openshockApiDomain)),
16+
("OPENSHOCK_FW_VERSION", env.StringifyMacro(openshockFwVersion))
1717
])

include/APIConnection.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class String;
88
class WebSocketsClient;
99

10-
namespace ShockLink {
10+
namespace OpenShock {
1111
class APIConnection {
1212
public:
1313
APIConnection(const String& authToken);
@@ -22,4 +22,4 @@ namespace ShockLink {
2222

2323
WebSocketsClient* m_webSocket;
2424
};
25-
} // namespace ShockLink
25+
} // namespace OpenShock

include/AuthenticationManager.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
#include <cstdint>
66

7-
namespace ShockLink::AuthenticationManager {
7+
namespace OpenShock::AuthenticationManager {
88
bool Authenticate(unsigned int pairCode);
99

1010
bool IsAuthenticated();
1111
String GetAuthToken();
1212
void ClearAuthToken();
13-
} // namespace ShockLink::AuthenticationManager
13+
} // namespace OpenShock::AuthenticationManager

include/CaptivePortal.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#include <cstdint>
77

8-
namespace ShockLink::CaptivePortal {
8+
namespace OpenShock::CaptivePortal {
99
bool Start();
1010
void Stop();
1111
bool IsRunning();
@@ -21,4 +21,4 @@ namespace ShockLink::CaptivePortal {
2121
serializeJson(doc, message);
2222
return BroadcastMessageTXT(message);
2323
}
24-
}; // namespace ShockLink::CaptivePortal
24+
}; // namespace OpenShock::CaptivePortal

include/Checksum.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <cstdint>
44

5-
namespace ShockLink::Checksum {
5+
namespace OpenShock::Checksum {
66
constexpr std::uint8_t CRC8(const std::uint8_t* data, std::size_t size) {
77
std::uint8_t checksum = 0;
88
for (std::size_t i = 0; i < size; ++i) {
@@ -14,4 +14,4 @@ namespace ShockLink::Checksum {
1414
constexpr std::uint8_t CRC8(T data) {
1515
return CRC8(reinterpret_cast<std::uint8_t*>(&data), sizeof(T));
1616
}
17-
} // namespace ShockLink::Checksum
17+
} // namespace OpenShock::Checksum

include/CommandHandler.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
// TODO: This is bad architecture. Fix it.
66

7-
namespace ShockLink::CommandHandler {
7+
namespace OpenShock::CommandHandler {
88
void Init();
99
bool HandleCommand(std::uint16_t shockerId,
1010
std::uint8_t method,
1111
std::uint8_t intensity,
1212
unsigned int duration,
1313
std::uint8_t shockerModel);
14-
} // namespace ShockLink::CommandHandler
14+
} // namespace OpenShock::CommandHandler

include/Constants.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
#include <cstdint>
44

5-
#ifndef SHOCKLINK_DOMAIN
6-
#define SHOCKLINK_DOMAIN "shocklink.net"
5+
#ifndef OPENSHOCK_DOMAIN
6+
#define OPENSHOCK_DOMAIN "shocklink.net"
77
#endif
88

9-
#ifndef SHOCKLINK_API_BASE_URL
10-
#define SHOCKLINK_API_BASE_URL "https://" SHOCKLINK_API_DOMAIN
9+
#ifndef OPENSHOCK_API_BASE_URL
10+
#define OPENSHOCK_API_BASE_URL "https://" OPENSHOCK_API_DOMAIN
1111
#endif
1212

13-
#define SHOCKLINK_API_URL(path) SHOCKLINK_API_BASE_URL path
13+
#define OPENSHOCK_API_URL(path) OPENSHOCK_API_BASE_URL path
1414

1515
/*
1616
Constants
@@ -20,7 +20,7 @@
2020
2121
Ref: https://esp32.com/viewtopic.php?t=8742
2222
*/
23-
namespace ShockLink::Constants {
23+
namespace OpenShock::Constants {
2424
extern const char* const Version;
2525
extern const char* const ApiDomain;
26-
} // namespace ShockLink::Constants
26+
} // namespace OpenShock::Constants

include/FileUtils.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
class String;
66

7-
namespace ShockLink::FileUtils {
7+
namespace OpenShock::FileUtils {
88
bool TryWriteFile(const char* path, const std::uint8_t* data, std::size_t size, bool overwrite = true);
99
bool TryWriteFile(const char* path, const String& str, bool overwrite = true);
1010

1111
bool TryReadFile(const char* path, String& str);
1212

1313
bool DeleteFile(const char* path);
14-
} // namespace ShockLink::FileUtils
14+
} // namespace OpenShock::FileUtils

include/PinPatternManager.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include <cstdint>
1010

11-
namespace ShockLink {
11+
namespace OpenShock {
1212
class PinPatternManager {
1313
public:
1414
PinPatternManager(unsigned int gpioPin);
@@ -33,4 +33,4 @@ namespace ShockLink {
3333
TaskHandle_t m_taskHandle;
3434
SemaphoreHandle_t m_taskSemaphore;
3535
};
36-
} // namespace ShockLink
36+
} // namespace OpenShock

include/RFTransmitter.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ struct QueueDefinition;
99
typedef QueueDefinition* QueueHandle_t;
1010
typedef void* TaskHandle_t;
1111

12-
namespace ShockLink {
12+
namespace OpenShock {
1313
class RFTransmitter {
1414
public:
1515
RFTransmitter(unsigned int gpioPin, int queueSize = 32);
@@ -33,4 +33,4 @@ namespace ShockLink {
3333
QueueHandle_t m_queueHandle;
3434
TaskHandle_t m_taskHandle;
3535
};
36-
} // namespace ShockLink
36+
} // namespace OpenShock

include/Rmt/MainEncoder.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <memory>
77
#include <vector>
88

9-
namespace ShockLink::Rmt {
9+
namespace OpenShock::Rmt {
1010
std::vector<rmt_data_t>
1111
GetSequence(std::uint16_t shockerId, std::uint8_t method, std::uint8_t intensity, std::uint8_t shockerModel);
1212
std::shared_ptr<std::vector<rmt_data_t>> GetZeroSequence(std::uint16_t shockerId, std::uint8_t shockerModel);

include/Rmt/PetTrainerEncoder.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
#include <cstdint>
66
#include <vector>
77

8-
namespace ShockLink::Rmt::PetTrainerEncoder {
8+
namespace OpenShock::Rmt::PetTrainerEncoder {
99
std::vector<rmt_data_t> GetSequence(std::uint16_t shockerId, std::uint8_t method, std::uint8_t intensity);
1010
}

include/Rmt/XlcEncoder.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <cstdint>
66
#include <vector>
77

8-
namespace ShockLink::Rmt::XlcEncoder {
8+
namespace OpenShock::Rmt::XlcEncoder {
99
std::vector<rmt_data_t>
1010
GetSequence(std::uint16_t transmitterId, std::uint8_t channelId, std::uint8_t method, std::uint8_t intensity);
1111
}

include/SerialInputHandler.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <cstdint>
44

5-
namespace ShockLink::SerialInputHandler {
5+
namespace OpenShock::SerialInputHandler {
66
void Init();
77
void Update();
8-
} // namespace ShockLink::SerialInputHandler
8+
} // namespace OpenShock::SerialInputHandler

include/Time.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <cstdint>
44

5-
namespace ShockLink {
5+
namespace OpenShock {
66
std::uint64_t Micros();
77
std::uint64_t Millis();
88
}

include/VisualStateManager.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include <cstdint>
66

7-
namespace ShockLink::VisualStateManager {
7+
namespace OpenShock::VisualStateManager {
88
void SetCriticalError();
99
void SetWiFiState(WiFiState state);
10-
} // namespace ShockLink::VisualStateManager
10+
} // namespace OpenShock::VisualStateManager

include/WiFiManager.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include <cstdint>
66

7-
namespace ShockLink::WiFiManager {
7+
namespace OpenShock::WiFiManager {
88
bool Init();
99

1010
WiFiState GetWiFiState();
@@ -14,4 +14,4 @@ namespace ShockLink::WiFiManager {
1414

1515
bool StartScan();
1616

17-
} // namespace ShockLink::WiFiManager
17+
} // namespace OpenShock::WiFiManager

include/WiFiState.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#pragma once
22

3-
namespace ShockLink {
3+
namespace OpenShock {
44
enum class WiFiState {
55
Disconnected,
66
Scanning,
77
Connecting,
88
Connected
99
};
10-
} // namespace ShockLink
10+
} // namespace OpenShock

src/APIConnection.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
const char* const TAG = "APIConnection";
1313

14-
using namespace ShockLink;
15-
1614
void handleControlCommandMessage(const DynamicJsonDocument& doc) {
1715
JsonArrayConst data = doc["Data"];
1816
for (int i = 0; i < data.size(); i++) {
@@ -22,6 +20,7 @@ void handleControlCommandMessage(const DynamicJsonDocument& doc) {
2220
std::uint8_t intensity = static_cast<std::uint8_t>(cur["Intensity"]);
2321
unsigned int duration = static_cast<unsigned int>(cur["Duration"]);
2422
std::uint8_t model = static_cast<std::uint8_t>(cur["Model"]);
23+
using namespace OpenShock;
2524

2625
if (!CommandHandler::HandleCommand(id, type, intensity, duration, model)) {
2726
ESP_LOGE(TAG, "Remote command failed/rejected!");
@@ -34,19 +33,21 @@ void HandleCaptivePortalMessage(const DynamicJsonDocument& doc) {
3433

3534
ESP_LOGD(TAG, "Captive portal debug: %s", data ? "true" : "false");
3635
if (data) {
37-
ShockLink::CaptivePortal::Start();
36+
OpenShock::CaptivePortal::Start();
3837
} else {
39-
ShockLink::CaptivePortal::Stop();
38+
OpenShock::CaptivePortal::Stop();
4039
}
4140
}
4241

42+
using namespace OpenShock;
43+
4344
APIConnection::APIConnection(const String& authToken) : m_webSocket(new WebSocketsClient()) {
44-
String firmwareVersionHeader = "FirmwareVersion: " + String(ShockLink::Constants::Version);
45+
String firmwareVersionHeader = "FirmwareVersion: " + String(Constants::Version);
4546
String deviceTokenHeader = "DeviceToken: " + authToken;
4647
m_webSocket->setExtraHeaders((firmwareVersionHeader + "\"" + deviceTokenHeader).c_str());
4748
m_webSocket->onEvent(
4849
std::bind(&APIConnection::handleEvent, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
49-
m_webSocket->beginSSL(ShockLink::Constants::ApiDomain, 443, "/1/ws/device");
50+
m_webSocket->beginSSL(Constants::ApiDomain, 443, "/1/ws/device");
5051
}
5152

5253
APIConnection::~APIConnection() {
@@ -55,7 +56,7 @@ APIConnection::~APIConnection() {
5556
}
5657

5758
void APIConnection::Update() {
58-
std::uint64_t msNow = ShockLink::Millis();
59+
std::uint64_t msNow = OpenShock::Millis();
5960

6061
static std::uint64_t lastKA = 0;
6162
if ((msNow - lastKA) >= 30'000) {

0 commit comments

Comments
 (0)