Skip to content

Commit

Permalink
LF and fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkness4 committed Sep 10, 2017
1 parent ffc0565 commit 5df2d67
Show file tree
Hide file tree
Showing 6 changed files with 194 additions and 196 deletions.
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

350 changes: 175 additions & 175 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,175 +1,175 @@
# CsgoGSI on Python and Arduino LCD shield

> A Counter-Strike: Global Offensive Game State Integration project based on python with screen on arduino
This project is using the [game state integration from csgo](https://developer.valvesoftware.com/wiki/Counter-Strike:_Global_Offensive_Game_State_Integration).
The informations are received by the program made in python and are shown on an arduino LCD shield.

### Features

- **Bomb timer (40s)**
- Health + kevlar bar
- Kills and headshots counter
- Money infoformations on buy time

## Table of Contents

- [Requirements](#requirements)
- [Install & Usage](#install--usage)
- [F.A.Q](#faq)

## Requirements

- [Python 3.x](https://www.python.org/downloads/) (tested on 3.6)

- pySerial package

Open a terminal:

```sh
pip install pyserial
```

or, if anaconda installed:

```sh
conda install pyserial
```

- qtpy package

Open a terminal:

```sh
pip install qtpy
```

or, if anaconda installed:

```sh
conda install qtpy
```

- PyQt5 or PyQt4 or PySide (tested with PyQt5)

Open a terminal:

```sh
pip install PyQt5
```

```sh
pip install PyQt4
```

```sh
pip install PySide
```

or, if anaconda installed:

```sh
conda install pyqt
```

```sh
conda install pyside
```

- Arduino (tested on UNO rev3)

- Arduino LCD KeyPad Shield (tested on v1.1)

- USB Ports

### Do not forget

Verify if the pin are the good ones on the arduino program for the LCD shield. (line 10)

```cs
LiquidCrystal(rs, enable, d4, d5, d6, d7)
```

For LCD shield v1.0. Comment line 17-22 and uncomment line 24-30 in the serialsend.ino. Like this:

```cs
// For V1.1 us this threshold
/*
if (adc_key_in < 50) return btnRIGHT;
if (adc_key_in < 250) return btnUP;
if (adc_key_in < 450) return btnDOWN;
if (adc_key_in < 650) return btnLEFT;
if (adc_key_in < 850) return btnSELECT;
*/
// For V1.0 comment the other threshold and use the one below:
if (adc_key_in < 50) return btnRIGHT;
if (adc_key_in < 195) return btnUP;
if (adc_key_in < 380) return btnDOWN;
if (adc_key_in < 555) return btnLEFT;
if (adc_key_in < 790) return btnSELECT;
```
## Install & Usage
### Using Binaries
- Download and execute csgo-gsi-arduino-lcd
### Using your Python
1. Clone/download this git
1. Move gamestate_integration_arduinotrack.cfg in Program Files (x86)\Steam\SteamApps\common\Counter-Strike Global Offensive\csgo\cfg.
1. Mount the shield on the arduino (obviously) and [push](https://www.arduino.cc/en/main/howto) the serialsend.ino in the arduino (remember the COM port).
1. Launch CSGO
1. Install the python program
```sh
python setup.py install
```
1. Run the python program (choose one and make sure you have added /Python/Scripts to Path)
Windows :
```sh
csgogsilcd.bat
```
Linux :
```sh
csgogsilcd
```
All :
```sh
python csgogsilcd
```
1. Choose the right COM
1. Play some CSGO and enjoy!
## F.A.Q
1. The needed port (3000 by default) is occupied. What should i do?
Replace in csgogsi.py, '3000' which is the default port (line 195, col 33) with the new corresponding port :
```python
SERVER = MyServer(('localhost', 3000), MyRequestHandler)
```
And in gamestate_integration_arduinotrack.cfg, line 3 :
```cfg
"uri" "http://127.0.0.1:3000"
```
1. Can i gather others informations than the ones proposed?
Yes, you can. The out.txt is an example of the payload which is storing all the informations from CS:GO. For more information, you can follow this [guide](https://github.com/tsuriga/csgo-gsi-qsguide) and [the official wiki about CS:GO GSI](https://developer.valvesoftware.com/wiki/Counter-Strike:_Global_Offensive_Game_State_Integration).
# CsgoGSI on Python and Arduino LCD shield

> A Counter-Strike: Global Offensive Game State Integration project based on python with screen on arduino
This project is using the [game state integration from csgo](https://developer.valvesoftware.com/wiki/Counter-Strike:_Global_Offensive_Game_State_Integration).
The informations are received by the program made in python and are shown on an arduino LCD shield.

### Features

- **Bomb timer (40s)**
- Health + kevlar bar
- Kills and headshots counter
- Money infoformations on buy time

## Table of Contents

- [Requirements](#requirements)
- [Install & Usage](#install--usage)
- [F.A.Q](#faq)

## Requirements

- [Python 3.x](https://www.python.org/downloads/) (tested on 3.6)

- pySerial package

Open a terminal:

```sh
pip install pyserial
```

or, if anaconda installed:

```sh
conda install pyserial
```

- qtpy package

Open a terminal:

```sh
pip install qtpy
```

or, if anaconda installed:

```sh
conda install qtpy
```

- PyQt5 or PyQt4 or PySide (tested with PyQt5)

Open a terminal:

```sh
pip install PyQt5
```

```sh
pip install PyQt4
```

```sh
pip install PySide
```

or, if anaconda installed:

```sh
conda install pyqt
```

```sh
conda install pyside
```

- Arduino (tested on UNO rev3)

- Arduino LCD KeyPad Shield (tested on v1.1)

- USB Ports

### Do not forget

Verify if the pin are the good ones on the arduino program for the LCD shield. (line 10)

```cs
LiquidCrystal(rs, enable, d4, d5, d6, d7)
```

For LCD shield v1.0. Comment line 17-22 and uncomment line 24-30 in the serialsend.ino. Like this:

```cs
// For V1.1 us this threshold
/*
if (adc_key_in < 50) return btnRIGHT;
if (adc_key_in < 250) return btnUP;
if (adc_key_in < 450) return btnDOWN;
if (adc_key_in < 650) return btnLEFT;
if (adc_key_in < 850) return btnSELECT;
*/
// For V1.0 comment the other threshold and use the one below:
if (adc_key_in < 50) return btnRIGHT;
if (adc_key_in < 195) return btnUP;
if (adc_key_in < 380) return btnDOWN;
if (adc_key_in < 555) return btnLEFT;
if (adc_key_in < 790) return btnSELECT;
```
## Install & Usage
### Using Binaries
- Download and execute csgo-gsi-arduino-lcd
### Using your Python
1. Clone/download this git
1. Move gamestate_integration_arduinotrack.cfg in Program Files (x86)\Steam\SteamApps\common\Counter-Strike Global Offensive\csgo\cfg.
1. Mount the shield on the arduino (obviously) and [push](https://www.arduino.cc/en/main/howto) the serialsend.ino in the arduino (remember the COM port).
1. Launch CSGO
1. Install the python program
```sh
python setup.py install
```
1. Run the python program (choose one and make sure you have added /Python/Scripts to Path)
Windows :
```sh
csgogsilcd.bat
```
Linux :
```sh
csgogsilcd
```
All :
```sh
python csgogsilcd
```
1. Choose the right COM
1. Play some CSGO and enjoy!
## F.A.Q
1. The needed port (3000 by default) is occupied. What should i do?
Replace in csgogsi.py, '3000' which is the default port (line 195, col 33) with the new corresponding port :
```python
SERVER = MyServer(('localhost', 3000), MyRequestHandler)
```
And in gamestate_integration_arduinotrack.cfg, line 3 :
```cfg
"uri" "http://127.0.0.1:3000"
```
1. Can i gather others informations than the ones proposed?
Yes, you can. The out.txt is an example of the payload which is storing all the informations from CS:GO. For more information, you can follow this [guide](https://github.com/tsuriga/csgo-gsi-qsguide) and [the official wiki about CS:GO GSI](https://developer.valvesoftware.com/wiki/Counter-Strike:_Global_Offensive_Game_State_Integration).
4 changes: 2 additions & 2 deletions csgogsilcd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/python
#!/usr/bin/python3

from csgo_gsi_arduino_lcd import main

main()
main()
9 changes: 4 additions & 5 deletions releases/csgo-gsi-arduino-lcd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
CSGO's informations displayed on an Arduino featuring a bomb timer.
Expand All @@ -15,17 +15,16 @@ from serial.tools import list_ports
from qtpy.QtWidgets import (QPushButton, QApplication, QComboBox,
QVBoxLayout, QHBoxLayout, QWidget)
from qtpy.QtCore import Slot, QThread, Qt
from qtpy.QtGui import QIcon


def get_round_phase(payload):
"""Get round phase"""
"""Get round phase."""
if 'round' in payload and 'phase' in payload['round']:
return payload['round']['phase']


def get_state(payload):
"""Get player status"""
"""Get player status."""
if 'player' in payload and 'state' in payload['player']:
return {'health': payload['player']['state']['health'],
'armor': payload['player']['state']['armor'],
Expand All @@ -35,7 +34,7 @@ def get_state(payload):


def get_bomb(payload):
"""Get bomb status"""
"""Get bomb status."""
if 'round' in payload and 'bomb' in payload['round']:
return payload['round']['bomb']

Expand Down
Loading

0 comments on commit 5df2d67

Please sign in to comment.