updated readme and removed magics from extension

This commit is contained in:
drevil 2023-11-03 19:58:52 -04:00
parent fe23bec72a
commit 5624075cc0
2 changed files with 5 additions and 2 deletions

View File

@ -4,6 +4,7 @@ Dumb and very poorly put together ESP8266 project I made for an old lamp in my r
## Installation
```bash
git clone https://tildegit.org/drevil/rlamp
mkdir ~/.local/share/gnome-shell/extensions/
cp -r rlamp/extension/rlamp@jmq.sh ~/.local/share/gnome-shell/extensions/rlamp@jmq.sh
gnome-extensions enable rlamp@jmq.sh
```

View File

@ -8,6 +8,8 @@ const PopupMenu = imports.ui.popupMenu;
const LMAP_HOSTNAME = "lamp.lan"
const LMAP_PORT = 2000
const TIMEOUT = 1.0
const READ_RETRIES = 5
let rlamp;
@ -20,7 +22,7 @@ class RLamp extends PanelMenu.Button {
{
let lampAddress = Gio.NetworkAddress.new(LMAP_HOSTNAME, LMAP_PORT);
let client = new Gio.SocketClient();
client.set_timeout(1.0);
client.set_timeout(TIMEOUT);
let connection = client.connect(lampAddress, null);
if (!connection) {
throw "Failed to connect to lamp on: " + lampAddress.get_hostname()
@ -44,7 +46,7 @@ class RLamp extends PanelMenu.Button {
getStatus()
{
for(let i = 0; i < 5; i++)
for(let i = 0; i < READ_RETRIES; i++)
{
let response = this.sendRequest("status");
if(response.lenght < 1)